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:
parent
159c1826d3
commit
b54a26cf8f
2
tasks.py
2
tasks.py
|
@ -428,7 +428,7 @@ def refresh_account_with_oldest_post():
|
||||||
AND NOT accounts.dormant
|
AND NOT accounts.dormant
|
||||||
ORDER BY posts.updated_at ASC
|
ORDER BY posts.updated_at ASC
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
""").columns(Post.id, Post.author_id)).one()
|
""").columns(Post.id, Post.author_id)).one_or_none()
|
||||||
if post:
|
if post:
|
||||||
aid = post.author_id
|
aid = post.author_id
|
||||||
refresh_account(aid)
|
refresh_account(aid)
|
||||||
|
|
Loading…
Reference in New Issue