perf: cache notifications for 1 minute
+ SWR for 5 minutes
This commit is contained in:
parent
378b638d34
commit
f177bb28a7
2 changed files with 3 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ from frappe.desk.doctype.notification_settings.notification_settings import (
|
|||
is_notifications_enabled,
|
||||
)
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils.caching import http_cache
|
||||
|
||||
|
||||
class NotificationLog(Document):
|
||||
|
|
@ -164,6 +165,7 @@ def get_email_header(doc, language: str | None = None):
|
|||
|
||||
|
||||
@frappe.whitelist()
|
||||
@http_cache(max_age=60, stale_while_revalidate=5 * 60)
|
||||
def get_notification_logs(limit=20):
|
||||
notification_logs = frappe.db.get_list(
|
||||
"Notification Log", fields=["*"], limit=limit, order_by="creation desc"
|
||||
|
|
|
|||
|
|
@ -329,6 +329,7 @@ class NotificationsView extends BaseNotificationsView {
|
|||
method: "frappe.desk.doctype.notification_log.notification_log.get_notification_logs",
|
||||
args: { limit: limit },
|
||||
type: "GET",
|
||||
cache: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue