Commit 1a8f2361 authored by Julian Rother's avatar Julian Rother
Browse files

Use scheduler to periodically update next meeting psa

parent b1fcaefe
......@@ -19,3 +19,4 @@ SQLITE_INIT_SCHEMA = True
SQLITE_INIT_DATA = False
#LDAP_HOST = 'ldaps://rumo.fsmpi.rwth-aachen.de'
#ICAL_URL = 'https://user:password@mail.fsmpi.rwth-aachen.de/SOGo/....ics'
......@@ -21,6 +21,7 @@ def get_next_meeting():
event = sorted(meetings, key=lambda e: e['DTSTART'].dt)[0]
return str(event['UID']), event['DTSTART'].dt.replace(tzinfo=None)
@sched_func(60*60)
def update_meeting():
try:
uid, start = get_next_meeting()
......
......@@ -8,6 +8,7 @@ import sys
import hashlib
import random
import sched
import time
app = Flask(__name__)
......@@ -19,6 +20,7 @@ app.add_template_global(timedelta, name='timedelta')
scheduler = sched.scheduler()
def run_scheduler():
time.sleep(1) # UWSGI does weird things on startup
while True:
scheduler.run()
......@@ -449,3 +451,5 @@ import feeds
import importer
import schedule
import sorter
if 'ICAL_URL' in config:
import meetings
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