diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index d944b7e..47982c2 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -1,6 +1,8 @@ ## next -* internals: make fetch_acc unique +* back off before hitting rate limit on mastodon instances +* fix: fetch\_acc running multiple copies fetching the same posts +* internals: increased frequency of refresh jobs, decreased frequency of bookkeeping jobs ## v1.4.3 diff --git a/libforget/mastodon.py b/libforget/mastodon.py index 6cdbaad..1665f2e 100644 --- a/libforget/mastodon.py +++ b/libforget/mastodon.py @@ -87,6 +87,8 @@ def get_api_for_acc(account): # https://github.com/tootsuite/mastodon/issues/4637 # so we have to do this: api.timeline() + if api.ratelimit_remaining / api.ratelimit_limit < 1/4: + raise TemporaryError("Rate limit too low") return api except MastodonUnauthorizedError as e: if sentry: