mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
More query before spawning task
This commit is contained in:
parent
2a726b7dfb
commit
6bb619d6ad
2 changed files with 6 additions and 5 deletions
|
@ -265,6 +265,8 @@ def task_cache_actor() -> _Response:
|
|||
|
||||
# Fetch the Open Grah metadata if it's a `Create`
|
||||
if activity.has_type(ap.ActivityType.CREATE):
|
||||
links = opengraph.links_from_note(activity.get_object().to_dict())
|
||||
if links:
|
||||
Tasks.fetch_og_meta(iri)
|
||||
|
||||
if activity.has_type(ap.ActivityType.FOLLOW):
|
||||
|
@ -475,8 +477,6 @@ def task_process_new_activity() -> _Response:
|
|||
DB.activities.update_one({"remote_id": activity.id}, {"$set": flags})
|
||||
|
||||
app.logger.info(f"new activity {iri} processed")
|
||||
if not activity.has_type(ap.ActivityType.DELETE):
|
||||
Tasks.cache_actor(iri)
|
||||
except (ActivityGoneError, ActivityNotFoundError):
|
||||
app.logger.exception(f"dropping activity {iri}, skip processing")
|
||||
return ""
|
||||
|
|
|
@ -174,9 +174,10 @@ def post_to_inbox(activity: ap.BaseActivity) -> None:
|
|||
return
|
||||
|
||||
save(Box.INBOX, activity)
|
||||
logger.info(f"spawning tasks for {activity!r}")
|
||||
if not activity.has_type(ap.ActivityType.DELETE):
|
||||
Tasks.cache_actor(activity.id)
|
||||
Tasks.process_new_activity(activity.id)
|
||||
|
||||
logger.info(f"spawning task for {activity!r}")
|
||||
Tasks.finish_post_to_inbox(activity.id)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue