Retry with pause for rounds

This commit is contained in:
Julian committed 2021-01-13 12:56:12 +01:00
1 parent cb5fd198ba
commit dae3d657e4
2 files changed
+18 -5

No files matched your search

@@ -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());
}
}
}