takahe/users/tasks/identity.py
Andrew Godwin fb6c409a9a Rework task system and fetching.
I can taste how close follow is to working.
2022-11-06 21:30:07 -07:00

12 lines
397 B
Python

from asgiref.sync import sync_to_async
from users.models import Identity
async def handle_identity_fetch(task_handler):
# Get the actor URI via webfinger
actor_uri, handle = await Identity.fetch_webfinger(task_handler.subject)
# Get or create the identity, then fetch
identity = await sync_to_async(Identity.by_actor_uri_with_create)(actor_uri)
await identity.fetch_actor()