Rename queryCount -> queryIndex

queryCount was "the count of queries until now, excluding this one",
which isn't as clear as "queryIndex" (especially in calculations).
queryIndex is a more usual way to name something that starts at 0 and
increases by one with each instance.

Test: atest
Change-Id: Id763decf7d2db7462c296955d6123cb1b14585fe
This commit is contained in:
Remi NGUYEN VAN 2024-10-08 13:17:36 +09:00
commit f4d6946440

View file

@ -57,9 +57,9 @@ public class QueryTaskConfig {
private final int burstCounter;
final long delayBeforeTaskWithoutBackoffMs;
private final boolean isFirstBurst;
private final long queryCount;
private final long queryIndex;
QueryTaskConfig(long queryCount, int transactionId,
QueryTaskConfig(long queryIndex, int transactionId,
boolean expectUnicastResponse, boolean isFirstBurst, int burstCounter,
int queriesPerBurst, int timeBetweenBurstsInMs,
long delayBeforeTaskWithoutBackoffMs) {
@ -70,7 +70,7 @@ public class QueryTaskConfig {
this.burstCounter = burstCounter;
this.delayBeforeTaskWithoutBackoffMs = delayBeforeTaskWithoutBackoffMs;
this.isFirstBurst = isFirstBurst;
this.queryCount = queryCount;
this.queryIndex = queryIndex;
}
QueryTaskConfig(int queryMode) {
@ -98,7 +98,7 @@ public class QueryTaskConfig {
this.timeBetweenBurstsInMs = INITIAL_TIME_BETWEEN_BURSTS_MS;
this.delayBeforeTaskWithoutBackoffMs = TIME_BETWEEN_QUERIES_IN_BURST_MS;
}
this.queryCount = 0;
this.queryIndex = 0;
}
long getDelayBeforeNextTaskWithoutBackoff(boolean isFirstQueryInBurst,
@ -137,7 +137,7 @@ public class QueryTaskConfig {
* Get new QueryTaskConfig for next run.
*/
public QueryTaskConfig getConfigForNextRun(int queryMode) {
long newQueryCount = queryCount + 1;
long newQueryCount = queryIndex + 1;
int newTransactionId = transactionId + 1;
if (newTransactionId > UNSIGNED_SHORT_MAX_VALUE) {
newTransactionId = 1;
@ -174,6 +174,6 @@ public class QueryTaskConfig {
if (burstCounter != 0 || isFirstBurst) {
return false;
}
return queryCount > numOfQueriesBeforeBackoff;
return queryIndex > numOfQueriesBeforeBackoff;
}
}