stelar7 / R4J

A Java library containing the API for every Riot game
Apache License 2.0
86 stars 29 forks source link

SpectatorAPI not working as exptected (gets old game) #92

Closed wafebreaker closed 6 months ago

wafebreaker commented 7 months ago

So i try to get the current Game via the SpectatorAPI and use this code:

SpectatorBuilder sb = new SpectatorBuilder().withPlatform(LeagueShard.EUW1); Summoner sum = new SummonerBuilder().withPlatform(LeagueShard.EUW1).withPUUID(SUMMONER_PUUID).get(); SpectatorGameInfo currentGame = sb.withSummonerId(sum.getSummonerId()).getCurrentGame(); System.out.println(currentGame);

But it gives me an old game (the last game), which is not up to date. When i use the Riot API from their docs i will get the correct game the summoner is currently playing.

What could cause this to happen?

stelar7 commented 6 months ago

The data is cached locally for 30 minutes. If you want to fetch more often than that, you need to manually clear the cache. That can be done with DataCall.getCacheProvider().clear(URLEndpoint.V4_SPECTATOR_CURRENT, Collections.emptyMap());