Users and Streams interfaces randomly change status after going offline

my name is Jacob Tybinski, I’m an amateur developer, this is my first post on the forum.

I’ve recently rebuilt my application that involves Twitch API. It’s done now, it’s behaviour and code source can be seen here:

Problem that came to my attention just when I was about to call it a day and roll out as finished is: when my stream (totally random one, created just to test my app) goes offline, after a minute or two twitch responses vary in content regardless of the actual status of the stream. Everything on platform says “offline”, but refreshing my requests gives random results - once it says that stream object in JSON response is a null, only to become full of false informations just as if I was just clicking online and offline repeatedly. Regardless of any delay between going offline and it being visible through the API, this behaviour completely suprised me. Responses aren’t cached in any way, I even refreshed it manually in browser just to see changing content in matter of seconds. Is this a known issue? What are the reasons of it behaving like that?

Thats caching for you.

Every api load you get a random server from the API Pool and that server might not be “right” yet.

1 Like

Correct me If I’m wrong, but does that mean that there are multiple servers that handle responding to the same API calls and at a given time they can hold different data under the same parameters? Is it pure luck, what you get and when, because you never know if you’ve just recieved data from a server that holds updated data or not?

Perhabs it’s a result of me being a total newbie, but that seems to be a bit silly.


1 Like

There has to be caching (possibly more or less “stale” data) involved to serve requests at large scale. No single authoritative server could handle the amount of traffic.

I am aware of that, but every single provider that I use (Google, Riot Games, openweather) keep the data everywhere the same at time T0 and then, when all of the servers have recieved updated data, they start serving it at T1.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.