Fix critical bugs
This commit is contained in:
@@ -17,6 +17,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
PREFIX_PO_PARAM = "notification_po_"
|
||||
|
||||
# Keep references to background tasks to prevent garbage collection
|
||||
_background_tasks: set[asyncio.Task] = set()
|
||||
|
||||
|
||||
class NotificationManagerService:
|
||||
"""Manages notification processing and integration with conversations.
|
||||
@@ -127,6 +130,8 @@ class NotificationManagerService:
|
||||
)
|
||||
|
||||
# Fire and forget - don't await
|
||||
_task = asyncio.create_task(save_notification_to_firestore())
|
||||
task = asyncio.create_task(save_notification_to_firestore())
|
||||
# Store reference to prevent premature garbage collection
|
||||
del _task
|
||||
_background_tasks.add(task)
|
||||
# Remove from set when done to prevent memory leak
|
||||
task.add_done_callback(_background_tasks.discard)
|
||||
|
||||
Reference in New Issue
Block a user