Streams endpoint bug (helix)?

I have an application which announces streams on twitch. I’m using the streams endpoint to do so and it was using the user_login parameter. I’ve recently changed this so it is using the user ids with the user_id parameter.
Since I’ve changed it, i’ve occured a strange behavior. Sometimes when a streamer is announced, in the next check it is said that the streamer went offline even though he didn’t. And then the stream is announced again. I have checked my logs and twitch does indeed skip a streamer now and then.
To visualize: here a very simplifyed and anonymized log:

Autocheck at 11/03/2021 19:18:51
"data": 
[
   {
         "user_login": "1",
   },
   {
         "user_login": "2",
   },
   {
         "user_login": "3",
   }
]

Autocheck at 11/03/2021 19:19:21
"data": 
[
   {
         "user_login": "1",
   },
   {
         "user_login": "2",
   }
]

Autocheck at 11/03/2021 19:19:51
"data": 
[
   {
         "user_login": "1",
   },
   {
         "user_login": "2",
   },
   {
         "user_login": "3",
   }
]

I’ve checked the queries as well and no id is skipped in the query. Is this an oversight on my end?

Sounds like you hit server (a) in the pool then server (b) in the pool. And b was a little behind on the cache.

You may also be interested in using EventSub instead. And then Twitch will tell you when a streamer goes live/offline instead. That would reduce errors

2 Likes

Looking at your timestamps you seem to be polling every 30 seconds, so it could very well be what Barry suggests.

Generally speaking you shouldn’t make the same request more than once per minutes or otherwise you could get a stale cache server, with the faster you poll the more likely this is to occur. This is not just for the streams endpoint but any API endpoint.

2 Likes

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