fix crash when tweets have been deleted oob

This commit is contained in:
codl 2017-08-07 14:15:08 +02:00
parent 1ba30bdb0a
commit 5b953122c3
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 1 additions and 1 deletions

View File

@ -126,7 +126,7 @@ def refresh_posts(posts):
for post in posts:
tweet = next((tweet for tweet in tweets if tweet['id_str'] == post.twitter_id), None)
if not tweet:
session.delete(post)
db.session.delete(post)
else:
post = db.session.merge(post_from_api_tweet_object(tweet))
refreshed_posts.append(post)