mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 21:24:28 +00:00
Tweak actor caching
This commit is contained in:
parent
4433a552c0
commit
b6751f511a
1 changed files with 8 additions and 2 deletions
|
@ -21,6 +21,7 @@ from core.activitypub import _actor_hash
|
||||||
from core.activitypub import _add_answers_to_question
|
from core.activitypub import _add_answers_to_question
|
||||||
from core.activitypub import no_cache
|
from core.activitypub import no_cache
|
||||||
from core.activitypub import post_to_outbox
|
from core.activitypub import post_to_outbox
|
||||||
|
from core.db import update_many_activities
|
||||||
from core.db import update_one_activity
|
from core.db import update_one_activity
|
||||||
from core.inbox import process_inbox
|
from core.inbox import process_inbox
|
||||||
from core.meta import MetaKey
|
from core.meta import MetaKey
|
||||||
|
@ -276,12 +277,17 @@ def task_cache_actor() -> _Response:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Cache the actor info
|
# Cache the actor info
|
||||||
DB.activities.update_many(
|
update_many_activities(
|
||||||
{
|
{
|
||||||
**flag(MetaKey.ACTOR_ID, actor.id),
|
**flag(MetaKey.ACTOR_ID, actor.id),
|
||||||
**flag(MetaKey.ACTOR_HASH, {"$ne": actor_hash}),
|
**flag(MetaKey.ACTOR_HASH, {"$ne": actor_hash}),
|
||||||
},
|
},
|
||||||
upsert({MetaKey.ACTOR: actor.to_dict(embed=True)}),
|
upsert(
|
||||||
|
{
|
||||||
|
MetaKey.ACTOR: actor.to_dict(embed=True),
|
||||||
|
MetaKey.ACTOR_HASH: actor_hash,
|
||||||
|
}
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO(tsileo): Also update following (it's in the object)
|
# TODO(tsileo): Also update following (it's in the object)
|
||||||
|
|
Loading…
Reference in a new issue