Browse Source

Merge pull request #1095 from pdvyas/fix-scheduler

Move scheduler_last_event to System Settings
version-14
Rushabh Mehta 10 years ago
parent
commit
14d09bfdb3
4 changed files with 21 additions and 4 deletions
  1. +10
    -1
      frappe/core/doctype/system_settings/system_settings.json
  2. +2
    -1
      frappe/patches.txt
  3. +7
    -0
      frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py
  4. +2
    -2
      frappe/utils/scheduler.py

+ 10
- 1
frappe/core/doctype/system_settings/system_settings.json View File

@@ -78,11 +78,20 @@
"in_list_view": 0,
"label": "Enable Scheduled Jobs",
"permlevel": 0
},
{
"fieldname": "scheduler_last_event",
"fieldtype": "Data",
"hidden": 1,
"label": "Scheduler Last Event",
"permlevel": 0,
"precision": "",
"report_hide": 1
}
],
"icon": "icon-cog",
"issingle": 1,
"modified": "2015-02-05 05:11:47.880614",
"modified": "2015-05-03 10:35:04.415621",
"modified_by": "Administrator",
"module": "Core",
"name": "System Settings",


+ 2
- 1
frappe/patches.txt View File

@@ -73,4 +73,5 @@ frappe.patches.v5_0.fix_email_alert
frappe.patches.v5_0.fix_null_date_datetime
frappe.patches.v5_0.force_sync_website
execute:frappe.delete_doc("DocType", "Tag")
execute:frappe.db.sql("delete from `tabProperty Setter` where `property` in ('idx', '_idx')")
execute:frappe.db.sql("delete from `tabProperty Setter` where `property` in ('idx', '_idx')")
frappe.patches.v5_0.move_scheduler_last_event_to_system_settings

+ 7
- 0
frappe/patches/v5_0/move_scheduler_last_event_to_system_settings.py View File

@@ -0,0 +1,7 @@
import frappe

def execute():
frappe.reload_doctype('System Settings')
last = frappe.db.get_global('scheduler_last_event')
frappe.db.set_value('System Settings', 'System Settings', 'scheduler_last_event', last)


+ 2
- 2
frappe/utils/scheduler.py View File

@@ -28,11 +28,11 @@ def enqueue_events(site):
return

nowtime = frappe.utils.now_datetime()
last = frappe.db.get_global('scheduler_last_event')
last = frappe.db.get_value('System Settings', 'System Settings', 'scheduler_last_event')

# set scheduler last event
frappe.db.begin()
frappe.db.set_global('scheduler_last_event', nowtime.strftime(DATETIME_FORMAT))
frappe.db.set_value('System Settings', 'System Settings', 'scheduler_last_event', nowtime.strftime(DATETIME_FORMAT))
frappe.db.commit()

out = []


Loading…
Cancel
Save