Skip to content

Commit

Permalink
log purger
Browse files Browse the repository at this point in the history
lbr88 committed Jan 3, 2025
1 parent 00ea0c1 commit 67d6e30
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions plugins/logmanager.py
Original file line number Diff line number Diff line change
@@ -72,10 +72,8 @@ async def log_purge(self, message: Message, lines_to_keep: int, max_requests: in
page += 1

if not delete_immediately:
# cast create_at to int
posts_to_delete = [{"create_at": int(posts[post_id]["create_at"]), "post_id": post_id} for post_id in posts_to_delete]
# sort posts by create_at
posts_to_delete = sorted(posts_to_delete, key=lambda x: x["create_at"])
# sort posts by id
posts_to_delete = sorted(posts_to_delete)
# keep the last 100
posts_to_delete = posts_to_delete[:-lines_to_keep]
for post_id in posts_to_delete:

0 comments on commit 67d6e30

Please sign in to comment.