Trigger write index after edit of a watch

This commit is contained in:
Leigh Morresi
2021-01-31 20:07:10 +01:00
parent 81534d9367
commit 86f2f54abe
2 changed files with 2 additions and 1 deletions

View File

@@ -235,7 +235,7 @@ def api_update():
datastore.data['watching'][uuid].update({'url': url, datastore.data['watching'][uuid].update({'url': url,
'tag': tag, 'tag': tag,
'headers':extra_headers}) 'headers':extra_headers})
datastore.needs_write = True
messages.append({'class': 'ok', 'message': 'Updated watch.'}) messages.append({'class': 'ok', 'message': 'Updated watch.'})

View File

@@ -127,6 +127,7 @@ class ChangeDetectionStore:
def sync_to_json(self): def sync_to_json(self):
print ("Saving index")
with open('/datastore/url-watches.json', 'w') as json_file: with open('/datastore/url-watches.json', 'w') as json_file:
json.dump(self.data, json_file, indent=4) json.dump(self.data, json_file, indent=4)
self.needs_write = False self.needs_write = False