Skip to content

Commit

Permalink
Make sync sleep more to avoid hitting secondary rate limits
Browse files Browse the repository at this point in the history
Some queries in sync that have the IN predicate can actually execute
multiple requests, last longer than query delay so the next query can
execute a request almost immediately after the last one. Add another
explicit sleep to counter that. Queries with IN predicates are already
expected to last longer than the delay, so adding a constant delay
should not have too much impact to total run time.
  • Loading branch information
nineinchnick committed May 7, 2024
1 parent b479b35 commit d8bbf3b
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,7 @@ private static boolean syncRerunJobs(Options options)
insertStatement.setLong(3 + i, ids.get(i));
}
rows += retryExecute(insertStatement);
MILLISECONDS.sleep(getQueryDelayMillis());
}
log.info(format("Inserted %d rows, took %s", rows, Duration.ofMillis(System.currentTimeMillis() - startTime)));
if (rows == 0) {
Expand Down Expand Up @@ -1551,6 +1552,7 @@ private static boolean syncCheckSuites(Options options)

long startTime = System.currentTimeMillis();
int rows = retryExecute(insertStatement);
MILLISECONDS.sleep(getQueryDelayMillis());
log.info(format("Inserted %d rows, took %s", rows, Duration.ofMillis(System.currentTimeMillis() - startTime)));
}
}
Expand Down Expand Up @@ -1614,6 +1616,7 @@ private static boolean syncCheckRuns(Options options)

long startTime = System.currentTimeMillis();
int rows = retryExecute(insertStatement);
MILLISECONDS.sleep(getQueryDelayMillis());
log.info(format("Inserted %d rows, took %s", rows, Duration.ofMillis(System.currentTimeMillis() - startTime)));
}
}
Expand Down Expand Up @@ -1677,6 +1680,7 @@ private static boolean syncCheckRunAnnotations(Options options)

long startTime = System.currentTimeMillis();
int rows = retryExecute(insertStatement);
MILLISECONDS.sleep(getQueryDelayMillis());
log.info(format("Inserted %d rows, took %s", rows, Duration.ofMillis(System.currentTimeMillis() - startTime)));
}
}
Expand Down

0 comments on commit d8bbf3b

Please sign in to comment.