fix: prevent unnecessary notification reloads for all users
- Emit WebSocket event only to the intended recipient instead of broadcasting - Improves performance by reducing unnecessary API calls and WebSocket traffic
This commit is contained in:
parent
7101fadd36
commit
a171f81738
@ -8,7 +8,8 @@ from frappe.model.document import Document
|
|||||||
|
|
||||||
class CRMNotification(Document):
|
class CRMNotification(Document):
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
frappe.publish_realtime("crm_notification")
|
if self.to_user:
|
||||||
|
frappe.publish_realtime("crm_notification", user= self.to_user)
|
||||||
|
|
||||||
def notify_user(args):
|
def notify_user(args):
|
||||||
"""
|
"""
|
||||||
@ -33,4 +34,4 @@ def notify_user(args):
|
|||||||
|
|
||||||
if frappe.db.exists("CRM Notification", values):
|
if frappe.db.exists("CRM Notification", values):
|
||||||
return
|
return
|
||||||
frappe.get_doc(values).insert(ignore_permissions=True)
|
frappe.get_doc(values).insert(ignore_permissions=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user