justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

Delay in removing offline channels from streams API #659

Open ubershmekel opened 7 years ago

ubershmekel commented 7 years ago

Hi twitch,

I have a webapp that plays the most popular streams for a given game: https://ubershmekel.github.io/twitchn/

The problem is when a stream goes offline - I get the offline event just fine, I then fetch the streams from e.g. https://api.twitch.tv/kraken/streams?client_id=...&game=Heroes%20of%20the%20Storm&pleasedontcache=0.49640725294810895&callback=jQuery112008215349876033768_1485452832426&_=1485452832427

But the offline stream is still listed there. It'll be listed there for 5-10 minutes too. Is that by design? This would require my app to remember which streams recently popped an offline event to manually remove them from the top streams list until the list catches up.

BarryCarlyon commented 7 years ago

Yes it's by design.

Caching of all end points has been discussed at length quite often.

A cache length of 3-5 minutes is about average across all end points.