Add break condition in cleanup script
This commit is contained in:
parent
c48ca60623
commit
f9b720e2e1
1 changed files with 4 additions and 0 deletions
|
@ -36,6 +36,10 @@ for i in range(5): # default: check 5 batches of 40 posts
|
||||||
# get next batch of posts
|
# get next batch of posts
|
||||||
last_posts = mastodon.account_statuses(getenv("MASTODON_USER_ID"), exclude_replies=True, max_id=id_oldest_of_last_posts, limit=40)
|
last_posts = mastodon.account_statuses(getenv("MASTODON_USER_ID"), exclude_replies=True, max_id=id_oldest_of_last_posts, limit=40)
|
||||||
|
|
||||||
|
# break if there are no more posts
|
||||||
|
if len(last_posts) == 0:
|
||||||
|
break
|
||||||
|
|
||||||
# delete all old posts of the current batch
|
# delete all old posts of the current batch
|
||||||
for submission in last_posts:
|
for submission in last_posts:
|
||||||
# if post has no favorites, boosts or replies, delete it
|
# if post has no favorites, boosts or replies, delete it
|
||||||
|
|
Loading…
Reference in a new issue