From 3cbfc5d69789e170997c2e9b25ce51467056ce2e Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 23 Oct 2024 23:34:40 +0300 Subject: [PATCH] logic fixes --- files/helpers/cron.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 57eab793e..ff0925608 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -438,14 +438,16 @@ def _cleanup_videos(): shadowbanned_media_usages_posts = db.query(MediaUsage).join(MediaUsage.post).join(Post.author).filter( MediaUsage.post_id != None, User.shadowbanned != None, - MediaUsage.created_utc < 9999999999, - ).all() + MediaUsage.created_utc < one_month_ago, + MediaUsage.removed_utc == None, + ).order_by(Post.id).all() shadowbanned_media_usages_comments = db.query(MediaUsage).join(MediaUsage.comment).join(Comment.author).filter( MediaUsage.comment_id != None, User.shadowbanned != None, - MediaUsage.created_utc < 9999999999, - ).all() + MediaUsage.created_utc < one_month_ago, + MediaUsage.removed_utc == None, + ).order_by(Comment.id).all() shadowbanned_media_usages = shadowbanned_media_usages_posts + shadowbanned_media_usages_comments