Retry with pause for rounds
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user