mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-07-07 12:16:30 +00:00
refactor(signals, tasks): update user verification task to use async and improve logging 🔨
This commit is contained in:
@ -7,7 +7,6 @@ from django.db.models.signals import post_save
|
||||
from api.models import User
|
||||
from django.contrib.auth.models import Permission
|
||||
from api.tasks import verify_user_with_person_api_task
|
||||
from asgiref.sync import sync_to_async
|
||||
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
@ -30,10 +29,9 @@ def assign_device_permissions(sender, instance, created, **kwargs):
|
||||
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
@sync_to_async
|
||||
def verify_user_with_person_api(sender, instance, created, **kwargs):
|
||||
async def verify_user_with_person_api(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
verify_user_with_person_api_task(instance.id)
|
||||
await verify_user_with_person_api_task.defer_async(instance.id)
|
||||
|
||||
|
||||
@receiver(reset_password_token_created)
|
||||
|
Reference in New Issue
Block a user