Merge pull request #172 from codl/avoid-limit
mastodon: stop before hitting the rate limit
This commit is contained in:
commit
41683fcffd
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue