Do not miss remaining tasks

This commit is contained in:
Adrià Casajús
2024-11-26 17:29:24 +01:00
parent f6239b5b59
commit f34ee1e6cd
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -55,18 +55,18 @@ class EventDispatcher:
if dispatcher is None:
dispatcher = GlobalDispatcher.get_dispatcher()
if config.EVENT_WEBHOOK_DISABLE:
LOG.i("Not sending events because webhook is disabled")
LOG.d("Not sending events because webhook is disabled")
return
if not config.EVENT_WEBHOOK and skip_if_webhook_missing:
LOG.i(
LOG.d(
"Not sending events because webhook is not configured and allowed to be empty"
)
return
partner_user = EventDispatcher.__partner_user(user.id)
if not partner_user:
LOG.i(f"Not sending events because there's no partner user for user {user}")
LOG.d(f"Not sending events because there's no partner user for user {user}")
return
event = event_pb2.Event(
+2 -2
View File
@@ -1011,6 +1011,8 @@ async def _hibp_process_queue_check(api_key: str, queue: asyncio.Queue):
try:
alias_id = queue.get_nowait()
except asyncio.QueueEmpty:
if len(alias_tasks) > 0:
await asyncio.gather(*alias_tasks, return_exceptions=True)
return
alias = Alias.get(alias_id)
@@ -1021,8 +1023,6 @@ async def _hibp_process_queue_check(api_key: str, queue: asyncio.Queue):
if len(alias_tasks) >= config.HIBP_CONCURRENT_TASKS:
await asyncio.gather(*alias_tasks, return_exceptions=True)
alias_tasks = []
if len(alias_tasks) > 0:
await asyncio.gather(*alias_tasks, return_exceptions=True)
async def _hibp_check_alias(alias: Alias, api_key: str, retries: int = 0):