Add another return condition in cleanup script
This commit is contained in:
parent
70625e5f1b
commit
0a084946a3
1 changed files with 3 additions and 0 deletions
|
@ -26,6 +26,9 @@ def cleanup(limit: int = 40, id: int | None = None):
|
|||
last_posts = mastodon.account_statuses(getenv("MASTODON_USER_ID"), exclude_replies=True, limit=limit)
|
||||
id_oldest_of_last_posts = -1
|
||||
for _ in range(4):
|
||||
# return if there are no posts to check
|
||||
if len(last_posts) == 0:
|
||||
return
|
||||
id_oldest_of_last_posts = last_posts[-1]["id"]
|
||||
last_posts = mastodon.account_statuses(getenv("MASTODON_USER_ID"), exclude_replies=True, max_id=id_oldest_of_last_posts, limit=limit)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue