-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do better retries when Mastodon fails (and maybe Twitter too?) #366
Comments
38 errors so far since this came up three days ago. I wonder:
|
No, The bot schedules one independent task for each channel linked to a case. If one of the tasks fails, it won't affect the other channels.
I checked some events in sentry and it seems the only channel affected is
I think we're getting this exception because the wrapper we're using implements the |
OK, great. So we killed the bankr cases bot on Twitter, perhaps it needs to die on Masto too. I'll go bug the [email protected] folks a second time... |
So I have a few ideas on this one and would like some input before I just start applying my own assumptions. Looking at the code @ERosendo referenced, the Mastodon API setting to allow us to do our own rate limit handling isn't great for our purposes. This is the exception that you get when you tell it you want to handle rate limit errors yourself: raise MastodonRatelimitError('Hit rate limit.') In the background it gathers stuff from the response headers telling it how long it's rate limited and when it should try again. But then that's the very helpful message it gives us. Thanks Mastodon.py. So this leaves us in a position where we can certainly detect the FACT that we've been rate limited, but would have no idea how long. So here's a few options: Option 1
Option 2
Option 3
All of the options share the same weakness: guessing at what the rate limit actually is. This leaves us in a position where if we guess too low then we'll just error out until all of our retries are gone, but if we guess too high, it would severely delay the sending of Mastodon messages. Technically there is an option to replace the Mastodon.py library with another one that supports better rate limit handling (or our own), but that's an even bigger unknown that I'd have to research. As well we could try to convince the maintainers of Mastodon.py (with an issue and PR) to provide us with the data on the rate limit in the exception, but I'm not sure what their appetite for that would be. |
Hm, my gut is that the simplest thing is the right answer, or at least the best place to begin to answer this. It's not a problem we get all the time, so maybe we can get away with the really simple thing and call it good enough. I'm also, if I'm being honest, not super concerned if we miss a mastodon post due to this, because there just aren't many people there, and it's more or less fallen in popularity. I don't want to contribute to that, but also I don't want to bend over backwards if nobody is there. My other thought is that it probably wouldn't be hard to tweak the mastodon exception to have a useful attribute, so maybe if just retrying using |
Sentry Issue: BIGCASES2-28
The text was updated successfully, but these errors were encountered: