From dfcc9287b8ca6df85f67ebcfae2f0a3cca7cdac5 Mon Sep 17 00:00:00 2001 From: codl Date: Fri, 8 Mar 2019 01:24:13 +0100 Subject: [PATCH] check for existence before refreshing oldest post/account this only happens when you don't have any accounts yet and it is a bad look the first time you set up a new forget install --- tasks.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tasks.py b/tasks.py index 954d25d..789dffa 100644 --- a/tasks.py +++ b/tasks.py @@ -389,7 +389,8 @@ def refresh_account_with_oldest_post(): .filter(Account.backoff_until < db.func.now()) .filter(~Account.dormant).group_by(Post).order_by( db.asc(Post.updated_at)).first()) - refresh_account(post.author_id) + if post: + refresh_account(post.author_id) @app.task @@ -399,7 +400,8 @@ def refresh_account_with_longest_time_since_refresh(): .filter(Account.backoff_until < db.func.now()) .filter(~Account.dormant).order_by(db.asc( Account.last_refresh)).first()) - refresh_account(acc.id) + if acc: + refresh_account(acc.id) @app.task