refresh task: ignore accounts with no tokens

This commit is contained in:
codl 2017-08-13 10:53:29 +02:00
parent 74f20e3138
commit bd574920b4
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 1 additions and 1 deletions

View File

@ -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)