mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Don't spawn a task when an activity has no attachments
This commit is contained in:
parent
6a459d0f87
commit
075d3c3742
2 changed files with 6 additions and 1 deletions
|
@ -284,7 +284,9 @@ def task_cache_actor() -> _Response:
|
||||||
# )
|
# )
|
||||||
|
|
||||||
app.logger.info(f"actor cached for {iri}")
|
app.logger.info(f"actor cached for {iri}")
|
||||||
if activity.has_type([ap.ActivityType.CREATE, ap.ActivityType.ANNOUNCE]):
|
if activity.has_type(
|
||||||
|
[ap.ActivityType.CREATE, ap.ActivityType.ANNOUNCE]
|
||||||
|
) and activity.get_object()._data.get("attachment", []):
|
||||||
Tasks.cache_attachments(iri)
|
Tasks.cache_attachments(iri)
|
||||||
|
|
||||||
except (ActivityGoneError, ActivityNotFoundError):
|
except (ActivityGoneError, ActivityNotFoundError):
|
||||||
|
|
|
@ -97,6 +97,9 @@ def _update_process_inbox(update: ap.Update, new_meta: _NewMeta) -> None:
|
||||||
actor = ap.fetch_remote_activity(obj.get_actor().id)
|
actor = ap.fetch_remote_activity(obj.get_actor().id)
|
||||||
update_cached_actor(actor)
|
update_cached_actor(actor)
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise ValueError(f"don't know how to update {obj!r}")
|
||||||
|
|
||||||
|
|
||||||
@process_inbox.register
|
@process_inbox.register
|
||||||
def _create_process_inbox(create: ap.Create, new_meta: _NewMeta) -> None:
|
def _create_process_inbox(create: ap.Create, new_meta: _NewMeta) -> None:
|
||||||
|
|
Loading…
Reference in a new issue