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,8 +68,21 @@ public class APIFootballUpdater {
S3Provider prov = new S3Provider();
prov.writeRoundsToS3(league, content);
} catch (Exception e) {
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());
}
}
}
public String getRawData(String requestUrl) throws Exception {

View File

@@ -17,25 +17,25 @@ public class APIFootballUpdaterTest {
}
@Test
public void updateFixturesTest() throws Exception {
public void updateFixturesTest() {
APIFootballUpdater updater = new APIFootballUpdater();
// updater.updateFixtures(1240);
}
@Test
public void updateAllFixturesTest() throws Exception {
public void updateAllFixturesTest() {
APIFootballUpdater updater = new APIFootballUpdater();
// updater.updateAllFixtures();
}
@Test
public void updateRoundsTest() throws Exception {
public void updateRoundsTest() {
APIFootballUpdater updater = new APIFootballUpdater();
// updater.updateRounds(2777);
}
@Test
public void updateAllRoundsTest() throws Exception {
public void updateAllRoundsTest() {
APIFootballUpdater updater = new APIFootballUpdater();
// updater.updateAllRounds();
}