Re #77 - Repair and refactor time threshold check code

pull/87/head
dgtlmoon 4 years ago
parent cff8959462
commit 0acf9cc9cb

@ -874,20 +874,25 @@ def ticker_thread_check_time_launch_checks():
# Look at the dataset, find a stale watch to process # Look at the dataset, find a stale watch to process
# Every minute check for new UUIDs to follow up on, should be inside the loop incase it changes. # Every minute check for new UUIDs to follow up on, should be inside the loop incase it changes.
minutes = datastore.data['settings']['requests']['minutes_between_check']
threshold = time.time() - (minutes * 60)
for uuid, watch in datastore.data['watching'].items(): for uuid, watch in datastore.data['watching'].items():
# If they supplied an individual entry minutes to recheck and its not the same as the default # If they supplied an individual entry minutes to threshold.
if 'minutes_between_check' in watch and minutes != watch['minutes_between_check']: if 'minutes_between_check' in watch:
threshold = time.time() - (watch['minutes_between_check'] * 60) max_time = watch['minutes_between_check'] * 60
else:
# Default system wide.
max_time = datastore.data['settings']['requests']['minutes_between_check'] * 60
threshold = time.time() - max_time
# Yeah, put it in the queue, it's more than time.
if not watch['paused'] and watch['last_checked'] <= threshold: if not watch['paused'] and watch['last_checked'] <= threshold:
if not uuid in running_uuids and uuid not in update_q.queue: if not uuid in running_uuids and uuid not in update_q.queue:
update_q.put(uuid) update_q.put(uuid)
time.sleep(0.1) # Wait a few seconds before checking the list again
time.sleep(3)
# Should be low so we can break this out in testing # Should be low so we can break this out in testing
app.config.exit.wait(1) app.config.exit.wait(1)

Loading…
Cancel
Save