identity_fetched: fix potential race condition
This commit is contained in:
parent
294cf6c624
commit
09b91712f7
1 changed files with 10 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
from datetime import datetime
|
||||
from time import sleep
|
||||
|
||||
from loguru import logger
|
||||
|
||||
|
@ -123,7 +124,15 @@ def post_deleted(pk, obj):
|
|||
|
||||
|
||||
def identity_fetched(pk):
|
||||
identity = Takahe.get_identity(pk)
|
||||
try:
|
||||
identity = Identity.objects.get(pk=pk)
|
||||
except Identity.DoesNotExist:
|
||||
sleep(2)
|
||||
try:
|
||||
identity = Identity.objects.get(pk=pk)
|
||||
except Identity.DoesNotExist:
|
||||
logger.warning(f"Fetched identity {pk} not found")
|
||||
return
|
||||
if identity.username and identity.domain:
|
||||
apid = Takahe.get_or_create_remote_apidentity(identity)
|
||||
if apid:
|
||||
|
|
Loading…
Add table
Reference in a new issue