Commit 9c7bbbdd authored by Julian Rother's avatar Julian Rother
Browse files

Send notifications for exceptions in scheduled functions

parent 7b9d3142
......@@ -22,6 +22,8 @@ def sched_func(delay, priority=0, firstdelay=None, args=[], kargs={}):
func(*args, **kargs)
except Exception:
notify_admins('scheduler_exception', name=func.__name__,
scheduler.enter(delay, priority, sched_wrapper)
scheduler.enter(firstdelay, priority, sched_wrapper)
print("Scheduler: registered {} (frequency 1/{}s, start delay: {}s)".format(func.__name__, delay, firstdelay))
......@@ -43,10 +43,10 @@ if not config.get('SECRET_KEY', None):
config['SECRET_KEY'] = os.urandom(24)
from db import query, modify, show, searchquery
from mail import notify_mods, notify_admins
from ldap import ldapauth
from legacy import legacy_index
from scheduler import sched_func
from mail import notify_mods, notify_admins
mod_endpoints = []
......@@ -124,7 +124,7 @@ def handle_not_found(e=None):
def handle_internal_error(e):
notify_admins('exception', traceback=traceback.format_exc())
notify_admins('endpoint_exception', traceback=traceback.format_exc())
return render_template('500.html'), 500
@sched_func(5*60, firstdelay=0)
Function: {{ name }}
Hostname: {{ gethostname() }}
{{ traceback }}
Exception in scheduler function "{{ name }}"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment