make rate limit check only for non-test runs

This commit is contained in:
Mark Eaton 2019-05-13 15:32:10 -04:00
parent 2f1a34852e
commit 6354876d53
1 changed files with 8 additions and 2 deletions

View File

@ -67,6 +67,10 @@ def checkToots(timeline, deleted_count=0):
deleted_count += 1
# unreblog the original toot (their toot), not the toot created by boosting (your toot)
if not options.test:
if mastodon.ratelimit_remaining == 0:
print(
"Rate limit reached. Waiting for a rate limit reset..."
)
mastodon.status_unreblog(toot.reblog)
else:
print(
@ -79,9 +83,11 @@ def checkToots(timeline, deleted_count=0):
time.sleep(
2
) # wait 2 secs between deletes to be a bit nicer to the server
if mastodon.ratelimit_remaining == 0:
print("Rate limit reached. Waiting for a rate limit reset...")
if not options.test:
if mastodon.ratelimit_remaining == 0:
print(
"Rate limit reached. Waiting for a rate limit reset..."
)
mastodon.status_delete(toot)
except MastodonError as e:
print("🛑 ERROR deleting toot - " + str(toot.id) + " - " + e.args[3])