Retry with pause for rounds

This commit is contained in:
2021-01-13 12:56:12 +01:00
parent 4f638c3111
commit 6fe026ee74
2 changed files with 18 additions and 5 deletions

View File

@@ -68,7 +68,20 @@ public class APIFootballUpdater {
S3Provider prov = new S3Provider();
prov.writeRoundsToS3(league, content);
} catch (Exception e) {
logger.error(e.getMessage());
if(e.getMessage().endsWith("did not have any results with status: 'Too many requests. Your rate limit is 10 requests per minute.")) {
try {
Thread.sleep(1000 * 60);
String content = getRawData(apiFootballUrl);
S3Provider prov = new S3Provider();
prov.writeRoundsToS3(league, content);
} catch (InterruptedException interruptedException) {
interruptedException.printStackTrace();
} catch (Exception exception) {
logger.error(e.getMessage());
}
} else {
logger.error(e.getMessage());
}
}
}