diff --git a/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java b/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java index a5aba7f..11f5fd8 100644 --- a/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java +++ b/src/main/java/de/jeyp91/apifootball/APIFootballUpdater.java @@ -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()); + } } } diff --git a/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java b/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java index 3811d70..529be99 100644 --- a/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java +++ b/src/test/java/de/jeyp91/apifootball/APIFootballUpdaterTest.java @@ -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(); }