Skip to content
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

Development: add a pause mechanism with user feedback when hitting rate limits #1

Open
aaribaud opened this issue Aug 23, 2020 · 0 comments

Comments

@aaribaud
Copy link
Owner

aaribaud commented Aug 23, 2020

Problem

When fetching a user's toots, the high fetch rate is bound to cause the Mastodon instance to rate-limit, which in effect causes all requests to fail with a message indicating the date and time until which rate-limiting will be lifted.
Release v0.2.0 of mastotool ignores these rate-limit responses, and therefore continues trying to fetch:

  1. without indicating to the user that a rate limit has been hit, and
  2. causing the instance to keep rate-limiting ad infinitum

Simple solution

  1. Define two running states for the fetch phase: fetching and rate-limited.
  2. Initial state is fetching.
  3. In fetching state, upon receipt of a rate-limit response, record the end-of-limit date and time and switch to rate-limited state.
  4. In rate-limited state, upon reaching the end-of-limit date and time, switch back to fetching state.
  5. In fetching state, behavior, including user feedback, remains unchanged with respect to v0.2.0.
  6. In rate-limited state, no API request is performed, and the user feedback shows the time remaining until rate limit is lifted.

Notes

This may involve modifying the go-mastodon library if it does not provide enough info to the user code about the rate-limiting responses yet.

References

Conversion at https://mastodon.art/web/statuses/104737809996624450

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant