diff options
| author | Andrew Godwin | 2022-11-06 13:48:04 -0700 | 
|---|---|---|
| committer | Andrew Godwin | 2022-11-06 13:48:04 -0700 | 
| commit | dbe57075d386d7474bafc208b654507d9a2d769e (patch) | |
| tree | 96b779d17753669f42b7569ec4ec66834b0673f4 /miniq | |
| parent | 8aec395331a1e9ec4ef1ea38aa20b8517131133b (diff) | |
| download | takahe-dbe57075d386d7474bafc208b654507d9a2d769e.tar.gz takahe-dbe57075d386d7474bafc208b654507d9a2d769e.tar.bz2 takahe-dbe57075d386d7474bafc208b654507d9a2d769e.zip  | |
Rework to a domains model for better vhosting
Diffstat (limited to 'miniq')
| -rw-r--r-- | miniq/migrations/0001_initial.py | 9 | ||||
| -rw-r--r-- | miniq/views.py | 7 | 
2 files changed, 12 insertions, 4 deletions
diff --git a/miniq/migrations/0001_initial.py b/miniq/migrations/0001_initial.py index 6775ff3..32c5d53 100644 --- a/miniq/migrations/0001_initial.py +++ b/miniq/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 4.1.3 on 2022-11-06 03:59 +# Generated by Django 4.1.3 on 2022-11-06 19:58  from django.db import migrations, models @@ -22,7 +22,12 @@ class Migration(migrations.Migration):                          verbose_name="ID",                      ),                  ), -                ("type", models.CharField(max_length=500)), +                ( +                    "type", +                    models.CharField( +                        choices=[("identity_fetch", "Identity Fetch")], max_length=500 +                    ), +                ),                  ("priority", models.IntegerField(default=0)),                  ("subject", models.TextField()),                  ("payload", models.JSONField(blank=True, null=True)), diff --git a/miniq/views.py b/miniq/views.py index 12da7cd..21275f8 100644 --- a/miniq/views.py +++ b/miniq/views.py @@ -64,5 +64,8 @@ class QueueProcessor(View):              await task.fail(f"{e}\n\n" + traceback.format_exc())      async def handle_identity_fetch(self, subject, payload): -        identity = await sync_to_async(Identity.by_handle)(subject) -        await identity.fetch_details() +        # Get the actor URI via webfinger +        actor_uri, handle = await Identity.fetch_webfinger(subject) +        # Get or create the identity, then fetch +        identity = await sync_to_async(Identity.by_actor_uri)(actor_uri, create=True) +        await identity.fetch_actor()  | 
