feat/add retry

This commit is contained in:
SouthFox 2022-11-09 02:30:39 +08:00
parent bfc9f05b7c
commit eb3bbf73db

View file

@ -222,7 +222,7 @@ def toot_process(statuses, my_acct, duplicates_counter=0):
# poll_id,emoji_list,visibility,reblogged,favourited,bookmarked,sensitive,reblogs_count,favourites_count,language)) # poll_id,emoji_list,visibility,reblogged,favourited,bookmarked,sensitive,reblogs_count,favourites_count,language))
return duplicates_counter return duplicates_counter
# @retry(stop=stop_after_attempt(7))
def archive_toot(url, archive_match): def archive_toot(url, archive_match):
mastodon, user = app_login(url) mastodon, user = app_login(url)
acct = mastodon.me().acct acct = mastodon.me().acct
@ -240,7 +240,11 @@ def archive_toot(url, archive_match):
print("检测到重复嘟文达到十次,取消存档……") print("检测到重复嘟文达到十次,取消存档……")
break break
statuses = mastodon.fetch_next(statuses) @retry(stop=stop_after_attempt(5))
def archive_retry():
return mastodon.fetch_next(statuses)
statuses = archive_retry()
if statuses == None: if statuses == None:
break break