Retry with pause for rounds
This commit is contained in:
@@ -68,7 +68,20 @@ public class APIFootballUpdater {
|
|||||||
S3Provider prov = new S3Provider();
|
S3Provider prov = new S3Provider();
|
||||||
prov.writeRoundsToS3(league, content);
|
prov.writeRoundsToS3(league, content);
|
||||||
} catch (Exception e) {
|
} 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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,25 +17,25 @@ public class APIFootballUpdaterTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateFixturesTest() throws Exception {
|
public void updateFixturesTest() {
|
||||||
APIFootballUpdater updater = new APIFootballUpdater();
|
APIFootballUpdater updater = new APIFootballUpdater();
|
||||||
// updater.updateFixtures(1240);
|
// updater.updateFixtures(1240);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateAllFixturesTest() throws Exception {
|
public void updateAllFixturesTest() {
|
||||||
APIFootballUpdater updater = new APIFootballUpdater();
|
APIFootballUpdater updater = new APIFootballUpdater();
|
||||||
// updater.updateAllFixtures();
|
// updater.updateAllFixtures();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateRoundsTest() throws Exception {
|
public void updateRoundsTest() {
|
||||||
APIFootballUpdater updater = new APIFootballUpdater();
|
APIFootballUpdater updater = new APIFootballUpdater();
|
||||||
// updater.updateRounds(2777);
|
// updater.updateRounds(2777);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateAllRoundsTest() throws Exception {
|
public void updateAllRoundsTest() {
|
||||||
APIFootballUpdater updater = new APIFootballUpdater();
|
APIFootballUpdater updater = new APIFootballUpdater();
|
||||||
// updater.updateAllRounds();
|
// updater.updateAllRounds();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user