kii-chan-reloaded / RedTwiBot

A Reddit/Twitch bot that will update your subreddit statusbar when streamers are playing your sub's game
GNU General Public License v3.0
0 stars 0 forks source link

Error! ('stream',) Retrying in one minute. Error! ('Expecting value: line 1 column 1 (char 0)',) Retrying in one minute. #3

Closed EthanC closed 7 years ago

EthanC commented 7 years ago

Opening a new Issue, as requested in #1.

Seems to be happening after extended periods of leaving the script running.

Summit1G is playing Blackwake
Summit1G is playing Blackwake
Summit1G is playing Blackwake
Summit1G is playing Blackwake
Summit1G is playing Blackwake
Summit1G is playing Blackwake
Summit1G is playing Blackwake
Summit1G is playing Blackwake
Error!

('stream',)

Retrying in one minute.
Error!

('Expecting value: line 1 column 1 (char 0)',)

Retrying in one minute.

Happened in both of my seperate instances of the script I had running overnight. First instance had 32 Streamers listed, second instance had 93 Streamers listed.

Will update to the latest commit in the Debugging Branch, as requested, and will report back with results in a day or so.

EthanC commented 7 years ago

Just got the error again after only an hour using the latest Debugging commit, happened only on my instance that has 93 Streamers listed. If it's worth noting, there's only ever 5-10 streamers of the 93 that are actually online.

CourageJD is playing H1Z1: King of the Kill
SmartGuy316 is playing IRL
Error!

  Line 199 -> 'stream'

Retrying in one minute.

It went back to working as intended after it slept for 1 minute and retried. If it is in-fact just API Rate Limiting it's not too big of a deal, since it auto-retry's, I just suggest putting a detailed error message for other users saying the Bot is being rate-limited so it's going to sleep for 1 minute.

EthanC commented 7 years ago

5 minutes later same issue.

Swiftor is playing Monopoly Plus
Scump is playing Call of Duty: Infinite Warfare
Attach is playing Call of Duty: Infinite Warfare
Zoomaa is playing Call of Duty: Infinite Warfare
Error!

  Line 199 -> 'stream'

Retrying in one minute.
kii-chan-reloaded commented 7 years ago

Well I'm not so sure that the rate limit is the issue. I did some request-spam testing, and I got up to 572 requests in just over 2 minutes before I stopped it myself - with the 1 second cooldown, the most the bot would do is a little over 120. For the time being, I've pushed a change to Debugging that will basically skip over the requests that cause any errors. Since I can't see what the bad requests look like, it will print the bad requests in the console. As usual, throw the output my way and I'll see what I can figure out about it.

EthanC commented 7 years ago

Updated both of my instances that are running, the smaller one with less streams returned this error immediately after running.

Importing praw
Importing re
Importing configparser
Importing time
Importing requests
Importing json
Loading configuration from file...
Configuration file read. Checking for usable values.
Found sections. Checking for values...
Found values for section R
Found values for section T
Found values for section M
Found values for section G
Found values for section S
Configuration seems usable. Using C:\Users\SERV\Desktop\StreamBot\configuration.ini
Bot successfully loaded. Entering main loop.
03/10/17, 11:31-
    Sidebar was updated
Error handling request. details:
{'error': 'Internal Server Error', 'message': '', 'status': 500}
Skipping until a fix is created
kii-chan-reloaded commented 7 years ago

Alright cool. So the 500 error is a general error that means the server you made a request to had problems, but it won't give us the specifics. That's alright, though, because now that I can see what I'm dealing with, I'll be able to write something to avoid it. Obviously, I won't be able to fully test this on my end since I'm, for whatever reason, not having the same issues as you, but it will be a simple fix that shouldn't need rigorous testing.

I just woke up, so it'll probably be like an hour or so before I'll get that change made. I'll make another comment when it's done.

kii-chan-reloaded commented 7 years ago

Workaround posted in Debugging branch. This will try 10 times to get a response from Twitch that isn't an error. If a streamer fails 10x to give a good response, they are skipped for that update.

Also, based upon my spam testing, I changed the cooldown to only 1/2 a second. I'm still on the fence about whether to lower it to 1/3 or to just get rid of it. My spam testing seems to show that there really isn't a rate limit (or if there is, it's difficult to hit), but it doesn't hurt to be nice to the servers. Plus, if there is a rate limit that's more long-term than ~250/minute for 2 minutes, this would lower the chances of hitting it.

EthanC commented 7 years ago

Been running for roughly 8 hours, haven't noticed it yet, will keep you updated. If the issue disappears for a day or two then I'd say it's safe to say we can close this?

kii-chan-reloaded commented 7 years ago

Sounds good to me! Glad to hear it's working alright for now.

EthanC commented 7 years ago

Going great! Script hasn't stopped since I started running it, also haven't seen it retry more than once, so I'd say we're good.

Thanks again for all the help, appreciate it.