From 249fab7014d0955ddaa3ee2f3d686b2c79152f1a Mon Sep 17 00:00:00 2001 From: codl Date: Mon, 11 Mar 2019 12:08:08 +0100 Subject: [PATCH 1/4] make fetch_acc unique now that it doesn't carry state info in its arguments, it's safe to skip dupes --- tasks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tasks.py b/tasks.py index 8060080..b489c94 100644 --- a/tasks.py +++ b/tasks.py @@ -96,6 +96,7 @@ def make_dormant(acc): @app.task(autoretry_for=(TemporaryError, )) +@unique def fetch_acc(id_): account = Account.query.get(id_) print(f'fetching {account}') From 0f3df6ad248bf1090337ec6c22fff202c3510a77 Mon Sep 17 00:00:00 2001 From: codl Date: Mon, 11 Mar 2019 12:12:04 +0100 Subject: [PATCH 2/4] remove leftover debug print, standardise task prints --- tasks.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tasks.py b/tasks.py index b489c94..15f40c2 100644 --- a/tasks.py +++ b/tasks.py @@ -99,7 +99,7 @@ def make_dormant(acc): @unique def fetch_acc(id_): account = Account.query.get(id_) - print(f'fetching {account}') + print("Fetching {}".format(account)) try: if not account.fetch_history_complete: oldest = (db.session.query(Post) @@ -140,7 +140,6 @@ def fetch_acc(id_): since_id = None - print('max_id: {}, since_id: {}'.format(max_id, since_id)) fetch_posts = noop if (account.service == 'twitter'): fetch_posts = libforget.twitter.fetch_posts @@ -267,7 +266,7 @@ def delete_from_account(account_id): break if to_delete: - print("deleting {}".format(to_delete)) + print("Deleting {}".format(to_delete)) account.touch_delete() action(to_delete) account.reset_backoff() From 2b39a614425637c3f223d1dd1105084a5f6552b3 Mon Sep 17 00:00:00 2001 From: codl Date: Mon, 11 Mar 2019 12:18:51 +0100 Subject: [PATCH 3/4] increased task frequency for refreshes. decreased for bookkeeping --- tasks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks.py b/tasks.py index 15f40c2..bcbbc50 100644 --- a/tasks.py +++ b/tasks.py @@ -438,12 +438,12 @@ def update_mastodon_instances_popularity(): db.session.commit() -app.add_periodic_task(120, periodic_cleanup) app.add_periodic_task(40, queue_fetch_for_most_stale_accounts) app.add_periodic_task(9, queue_deletes) -app.add_periodic_task(60, refresh_account_with_oldest_post) -app.add_periodic_task(180, refresh_account_with_longest_time_since_refresh) -app.add_periodic_task(61, update_mastodon_instances_popularity) +app.add_periodic_task(25, refresh_account_with_oldest_post) +app.add_periodic_task(50, refresh_account_with_longest_time_since_refresh) +app.add_periodic_task(300, periodic_cleanup) +app.add_periodic_task(300, update_mastodon_instances_popularity) if __name__ == '__main__': app.worker_main() From 27df3e1a512ea3b6986256b270c961ae02846bb6 Mon Sep 17 00:00:00 2001 From: codl Date: Mon, 11 Mar 2019 16:25:15 +0100 Subject: [PATCH 4/4] update changelog --- CHANGELOG.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 4ffc8d9..d944b7e 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -1,3 +1,7 @@ +## next + +* internals: make fetch_acc unique + ## v1.4.3 Released 2019-03-11