Push newly created watches directly into the update check Queue.

pull/11/head
Leigh Morresi 4 years ago
parent bbd99c9aa9
commit 6a102374c6

@ -310,7 +310,10 @@ def api_watch_add():
global messages global messages
# @todo add_watch should throw a custom Exception for validation etc # @todo add_watch should throw a custom Exception for validation etc
datastore.add_watch(url=request.form.get('url').strip(), tag=request.form.get('tag').strip()) new_uuid = datastore.add_watch(url=request.form.get('url').strip(), tag=request.form.get('tag').strip())
# Straight into the queue.
update_q.put(new_uuid)
messages.append({'class': 'ok', 'message': 'Watch added.'}) messages.append({'class': 'ok', 'message': 'Watch added.'})
return redirect(url_for('main_page')) return redirect(url_for('main_page'))

@ -128,15 +128,16 @@ class ChangeDetectionStore:
validators.url(url) validators.url(url)
# @todo use a common generic version of this # @todo use a common generic version of this
new_uuid = str(uuid_builder.uuid4())
_blank = self.generic_definition.copy() _blank = self.generic_definition.copy()
_blank.update({ _blank.update({
'url': url, 'url': url,
'tag': tag, 'tag': tag,
'uuid': str(uuid_builder.uuid4()) 'uuid': new_uuid
}) })
self.data['watching'].update({_blank['uuid']: _blank}) self.data['watching'].update({_blank['uuid']: _blank})
return new_uuid
def sync_to_json(self): def sync_to_json(self):

Loading…
Cancel
Save