fix exception when no posts are in database

Instead of using Query.one use Query.one_or_none. The check after
setting the variable suggests this was the intended behaviour instead
of throwing errors if there are no posts in the database.
This commit is contained in:
Johann150 2021-12-09 18:57:00 +01:00
parent 159c1826d3
commit b54a26cf8f
No known key found for this signature in database
GPG Key ID: 9EE6577A2A06F8F1
1 changed files with 1 additions and 1 deletions

View File

@ -428,7 +428,7 @@ def refresh_account_with_oldest_post():
AND NOT accounts.dormant
ORDER BY posts.updated_at ASC
LIMIT 1;
""").columns(Post.id, Post.author_id)).one()
""").columns(Post.id, Post.author_id)).one_or_none()
if post:
aid = post.author_id
refresh_account(aid)