fix notification.emit return to return coro incase we don't have any targets.

This commit is contained in:
ArabCoders 2025-03-23 00:46:24 +03:00
parent c46aa1cfe4
commit 37ef9314cb

View file

@ -389,11 +389,8 @@ class Notification(metaclass=Singleton):
return {"url": target.request.url, "status": 500, "text": str(ev)}
def emit(self, e: Event, _, **kwargs): # noqa: ARG002
if len(self._targets) < 1:
return []
if not NotificationEvents.is_valid(e.event):
return []
if len(self._targets) < 1 or not NotificationEvents.is_valid(e.event):
return asyncio.sleep(0)
return self.send(e)