Read DB changes from disk
Without this commit, only events managed through WebUI are correctly modified, making the tick-based approach only partially useful
This commit is contained in:
parent
7f4fd09a78
commit
cf58424524
1 changed files with 8 additions and 1 deletions
|
@ -17,7 +17,13 @@ from .audiogen import audiogenerate
|
|||
class EventModel(object):
|
||||
def __init__(self, uri):
|
||||
self.uri = uri
|
||||
self.db = TinyDB(uri)
|
||||
self.db = None
|
||||
self.reload()
|
||||
|
||||
def reload(self):
|
||||
if self.db is not None:
|
||||
self.db.close()
|
||||
self.db = TinyDB(self.uri)
|
||||
self.actions = self.db.table('actions')
|
||||
self.alarms = self.db.table('alarms')
|
||||
|
||||
|
@ -104,6 +110,7 @@ class Monitor(ParentedLet):
|
|||
it is advisable to run it in its own greenlet); if the event is "near
|
||||
enough", schedule it; if it is too far, or already expired, ignore it.
|
||||
'''
|
||||
self.model.reload()
|
||||
for alarm, action in self.model.get_all_alarms_expanded():
|
||||
if alarm.eid in self.running:
|
||||
continue
|
||||
|
|
Loading…
Reference in a new issue