fix: clean up logs job was broken
This commit is contained in:
parent
c332254688
commit
c2c858f70e
3 changed files with 5 additions and 3 deletions
|
|
@ -48,6 +48,7 @@ def clear_activity_logs(days=None):
|
|||
if not days:
|
||||
days = 90
|
||||
doctype = DocType("Activity Log")
|
||||
duration = (Now() - Interval(days=days))
|
||||
frappe.db.delete(doctype, filters=(
|
||||
doctype.creation < PseudoColumn(f"({Now() - Interval(days=days)})")
|
||||
doctype.creation < duration
|
||||
))
|
||||
|
|
@ -18,8 +18,9 @@ class LogSettings(Document):
|
|||
|
||||
def clear_error_logs(self):
|
||||
table = DocType("Error Log")
|
||||
duration = (Now() - Interval(days=self.clear_error_log_after))
|
||||
frappe.db.delete(table, filters=(
|
||||
table.creation < PseudoColumn(f"({Now() - Interval(days=self.clear_error_log_after)})")
|
||||
table.creation < duration
|
||||
))
|
||||
|
||||
def clear_activity_logs(self):
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ def clear_outbox(days=None):
|
|||
days=31
|
||||
|
||||
email_queues = frappe.db.sql_list("""SELECT `name` FROM `tabEmail Queue`
|
||||
WHERE `priority`=0 AND `modified` < (NOW() - INTERVAL '{0}' DAY)""".format(days))
|
||||
WHERE `modified` < (NOW() - INTERVAL '{0}' DAY)""".format(days))
|
||||
|
||||
if email_queues:
|
||||
frappe.db.delete("Email Queue", {"name": ("in", email_queues)})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue