log info on failure (#44)

This commit is contained in:
nanos 2023-04-30 16:54:13 +01:00
parent 1fffddcb23
commit 22b185172f

View file

@ -72,13 +72,18 @@ def add_user_posts(server, access_token, followings, know_followings, all_known_
count = 0 count = 0
failed = 0 failed = 0
for post in posts: for post in posts:
if post['reblog'] == None and post['url'] != None and post['url'] not in seen_urls: try:
added = add_post_with_context(post, server, access_token, seen_urls) if post['reblog'] == None and post['url'] != None and post['url'] not in seen_urls:
if added is True: added = add_post_with_context(post, server, access_token, seen_urls)
seen_urls.add(post['url']) if added is True:
count += 1 seen_urls.add(post['url'])
else: count += 1
failed += 1 else:
failed += 1
except Exception as ex:
log(f"Error adding post {post}")
raise
log(f"Added {count} posts for user {user['acct']} with {failed} errors") log(f"Added {count} posts for user {user['acct']} with {failed} errors")
if failed == 0: if failed == 0:
know_followings.add(user['acct']) know_followings.add(user['acct'])