// We're the first to find out that quota is gone. We may or may not have succeeded on this call,
// depending on the status code. Regardless of the status code, fix the scheduling of moves updates
// that would otherwise happen before the next quota window opens up.
List<UpdateWorkerTask> updateWorkerTasks = connectorUpdateService.getScheduledUpdateWorkerTasksForConnectorNameBeforeTime("moves", nextQuotaAvailableTime);
for (int i=0; i<updateWorkerTasks.size(); i++) {
UpdateWorkerTask updateWorkerTask = updateWorkerTasks.get(i);
// Space the tasks 30 seconds apart so they don't all try to start at the same time
long rescheduleTime = nextQuotaAvailableTime + i*(DateTimeConstants.MILLIS_PER_SECOND*30);
// Update the scheduled execution time for any moves tasks that would otherwise happen during
// the current quota outage far enough into the future that we should have quota available by then.
// If there's more than one pending, stagger them by a few minutes so that they don't all try to
// happen at once. The reason the "incrementRetries" arg is true is that that appears to be the
// way to prevent spawning a duplicate entry in the UpdateWorkerTask table.
connectorUpdateService.reScheduleUpdateTask(updateWorkerTask.getId(),
rescheduleTime,
true,null);
logger.info("module=movesUpdater component=fetchMovesAPI action=fetchMovesAPI" +
" message=\"Rescheduling due to quota limit: " +