Przeglądaj źródła

Enqueued communication patch if more than 1 lakh records

version-14
Nabin Hait 7 lat temu
rodzic
commit
8463937acd
1 zmienionych plików z 9 dodań i 1 usunięć
  1. +9
    -1
      frappe/patches/v9_1/move_feed_to_activity_log.py

+ 9
- 1
frappe/patches/v9_1/move_feed_to_activity_log.py Wyświetl plik

@@ -1,6 +1,14 @@
import frappe
from frappe.utils.background_jobs import enqueue

def execute():
comm_records_count = frappe.db.count("Communication", {"comment_type": "Updated"})
if comm_records_count > 100000:
enqueue(method=move_data_from_communication_to_activity_log, queue='short', now=True)
else:
move_data_from_communication_to_activity_log()

def move_data_from_communication_to_activity_log():
frappe.reload_doc("core", "doctype", "communication")
frappe.reload_doc("core", "doctype", "activity_log")

@@ -12,4 +20,4 @@ def execute():
where comment_type = 'Updated'""")

frappe.db.sql("""delete from `tabCommunication` where comment_type = 'Updated'""")
frappe.delete_doc("DocType", "Authentication Log")
frappe.delete_doc("DocType", "Authentication Log")

Ładowanie…
Anuluj
Zapisz