Simplified number of batches in cleanup script
This commit is contained in:
parent
0a084946a3
commit
bca10829a5
1 changed files with 5 additions and 4 deletions
|
@ -39,11 +39,12 @@ def cleanup(limit: int = 40, id: int | None = None):
|
|||
if len(last_posts) == 0:
|
||||
return
|
||||
|
||||
# ----- delete old posts ----- #
|
||||
# ----- delete old inactive posts ----- #
|
||||
|
||||
# default: check 2 batches of 40 posts (and 6 batches if the id was set manually)
|
||||
num_batches = 2 if id is None else 6
|
||||
for i in range(num_batches):
|
||||
# default: check 10 batches of 40 posts
|
||||
# this usually tries until the rate limit is triggered or there are no more posts
|
||||
# if hitting the rate limit is undesired, reduce the number of iterations
|
||||
for i in range(10):
|
||||
# skip getting new batch in the first iteration if the id was set manually
|
||||
if i != 0 or id is None:
|
||||
# find id of the currently oldest post
|
||||
|
|
Loading…
Reference in a new issue