feat(scheduler): Frequent job scheduling
Scheduler tick interval (default 60 seconds) can now be configured with scheduler_tick_interval key in common_site_config.json
This commit is contained in:
parent
d2369f76f6
commit
692055499a
2 changed files with 5 additions and 1 deletions
|
|
@ -84,6 +84,10 @@ class ScheduledJobType(Document):
|
|||
|
||||
def update_scheduler_log(self, status):
|
||||
if not self.create_log:
|
||||
# self.get_next_execution will work properly iff self.last_execution is properly set
|
||||
if self.frequency == "All" and status == 'Start':
|
||||
self.db_set('last_execution', now_datetime(), update_modified=False)
|
||||
frappe.db.commit()
|
||||
return
|
||||
if not self.scheduler_log:
|
||||
self.scheduler_log = frappe.get_doc(dict(doctype = 'Scheduled Job Log', scheduled_job_type=self.name)).insert(ignore_permissions=True)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ def start_scheduler():
|
|||
'''Run enqueue_events_for_all_sites every 2 minutes (default).
|
||||
Specify scheduler_interval in seconds in common_site_config.json'''
|
||||
|
||||
schedule.every(60).seconds.do(enqueue_events_for_all_sites)
|
||||
schedule.every(frappe.get_conf().scheduler_tick_interval or 60).seconds.do(enqueue_events_for_all_sites)
|
||||
|
||||
while True:
|
||||
schedule.run_pending()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue