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
This commit is contained in:
codl 2019-03-08 01:24:13 +01:00
parent fa832412fa
commit dfcc9287b8
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 4 additions and 2 deletions

View File

@ -389,6 +389,7 @@ 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())
if post:
refresh_account(post.author_id)
@ -399,6 +400,7 @@ 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())
if acc:
refresh_account(acc.id)