-
Notifications
You must be signed in to change notification settings - Fork 36
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
Throttling, Retrying #69
Comments
I've been trying some stuff, and I'm leaning towards an approach based on the Executors and Futures in Python 3's I'm trying to implement a Internally, the As suggested in the OP, this might be used by having a (My implementation is at about 150 lines, but it's broken.) |
This is a throttling/retrying utility based on backported Python 3 Executors and Futures. This implementation and test are a mess, but are at least partially correct. #69
As discussed in #59, we want to have some universal throttling mechanism for client requests.
Throttling
When we post a new message, or edit one, the requests are throttled, and retried when appropriate. This is good, but doesn't apply to any of the other requests we make. We should generalize the existing code, and make it easy to apply for different types of requests. (There would need to be some code specific to recognizing success/temporary error/fatal error for different types of requests.) Ignoring the implementation for a sec, what behaviour do we want?
It might be reasonable to have two requests queues, one for read requests and one for write requests. That way we can keep seeing updates, even while our chat messages are throttled and being retried. Maybe by default they could limit us to one request per five seconds, or maybe a smaller limit that increases if we keep sending a lot of requests. Or maybe the read queue could allow a couple requests to be in-flight at once, while writing is limited to a single request.
The text was updated successfully, but these errors were encountered: