Tweak the tasks flow

This commit is contained in:
Thomas Sileo 2018-07-17 23:46:12 +02:00
parent ac5f349d0f
commit 13cee5dbae
3 changed files with 4 additions and 2 deletions

3
app.py
View file

@ -80,9 +80,10 @@ back = activitypub.MicroblogPubBackend()
def save_cb(box: Box, iri: str) -> None: def save_cb(box: Box, iri: str) -> None:
tasks.cache_attachments.delay(iri)
if box == Box.INBOX: if box == Box.INBOX:
tasks.process_new_activity.delay(iri) tasks.process_new_activity.delay(iri)
else:
tasks.cache_attachments.delay(iri)
back.set_save_cb(save_cb) back.set_save_cb(save_cb)

View file

@ -72,7 +72,7 @@ with open(os.path.join(KEY_DIR, "me.yml")) as f:
PASS = conf["pass"] PASS = conf["pass"]
EXTRA_INBOXES = conf.get("extra_inboxes", []) EXTRA_INBOXES = conf.get("extra_inboxes", [])
HIDE_FOLLOWING = strtobool(conf.get("hide_following", "false")) HIDE_FOLLOWING = conf.get("hide_following", False)
# Theme-related config # Theme-related config
theme_conf = conf.get("theme", {}) theme_conf = conf.get("theme", {})

View file

@ -54,6 +54,7 @@ def process_new_activity(self, iri: str) -> None:
) )
log.info(f"new activity {iri} processed") log.info(f"new activity {iri} processed")
cache_attachments.delay(iri)
except (ActivityGoneError, ActivityNotFoundError): except (ActivityGoneError, ActivityNotFoundError):
log.exception(f"dropping activity {iri}") log.exception(f"dropping activity {iri}")
except Exception as err: except Exception as err: