refresh task: ignore accounts with no tokens
This commit is contained in:
parent
74f20e3138
commit
bd574920b4
2
tasks.py
2
tasks.py
|
@ -183,7 +183,7 @@ def refresh_account_with_oldest_post():
|
|||
|
||||
@app.task(autoretry_for=(TwitterError, URLError))
|
||||
def refresh_account_with_longest_time_since_refresh():
|
||||
acc = Account.query.order_by(db.asc(Account.last_refresh)).first()
|
||||
acc = Account.query.join(Account.tokens).group_by(Account).having(db.func.count(OAuthToken.token) > 0).order_by(db.asc(Account.last_refresh)).first()
|
||||
refresh_account(acc.id)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue