[fix] bulk email indexing

This commit is contained in:
Rushabh Mehta 2016-05-25 10:35:29 +05:30
parent bfb8f8eac0
commit ff003da663
3 changed files with 14 additions and 6 deletions

View file

@ -3,6 +3,7 @@
"allow_import": 0,
"allow_rename": 0,
"autoname": "hash",
"beta": 0,
"creation": "2012-08-02 15:17:28",
"custom": 0,
"description": "Bulk Email records.",
@ -106,7 +107,7 @@
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
@ -271,7 +272,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-04-18 05:13:07.741981",
"modified": "2016-05-25 10:33:47.439401",
"modified_by": "Administrator",
"module": "Email",
"name": "Bulk Email",
@ -298,7 +299,9 @@
"write": 0
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"sort_order": "DESC"
"sort_order": "DESC",
"track_seen": 0
}

View file

@ -20,4 +20,8 @@ def retry_sending(name):
@frappe.whitelist()
def send_now(name):
doc = frappe.get_doc("Bulk Email", name)
send_one(doc, now=True)
send_one(doc, now=True)
def on_doctype_update():
"""Add index in `tabCommunication` for `(reference_doctype, reference_name)`"""
frappe.db.add_index("Bulk Email", ["creation"])

View file

@ -192,9 +192,10 @@ def clear_old_snapshots():
today = datetime.datetime.now()
for file in os.listdir(path):
ctime = datetime.datetime.fromtimestamp(os.path.getctime(file))
p = os.path.join(path, file)
ctime = datetime.datetime.fromtimestamp(os.path.getctime(p))
if (today - ctime).days > 31:
os.remove(os.path.join(path, file))
os.remove(os.path.join(path, p))
def get_error_snapshot_path():
return frappe.get_site_path('error-snapshots')