Bug fix - automatically queued watch checks weren't always being processed sequentially

pull/861/head
dgtlmoon 2 years ago committed by GitHub
parent 1193a7f22c
commit f04adb7202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1385,13 +1385,18 @@ def ticker_thread_check_time_launch_checks():
seconds_since_last_recheck = now - watch['last_checked'] seconds_since_last_recheck = now - watch['last_checked']
if seconds_since_last_recheck >= (threshold + watch.jitter_seconds) and seconds_since_last_recheck >= recheck_time_minimum_seconds: if seconds_since_last_recheck >= (threshold + watch.jitter_seconds) and seconds_since_last_recheck >= recheck_time_minimum_seconds:
if not uuid in running_uuids and uuid not in [q_uuid for p,q_uuid in update_q.queue]: if not uuid in running_uuids and uuid not in [q_uuid for p,q_uuid in update_q.queue]:
print("> Queued watch UUID {} last checked at {} queued at {:0.2f} jitter {:0.2f}s, {:0.2f}s since last checked".format(uuid, # Use Epoch time as priority, so we get a "sorted" PriorityQueue, but we can still push a priority 1 into it.
watch['last_checked'], priority = int(time.time())
now, print(
watch.jitter_seconds, "> Queued watch UUID {} last checked at {} queued at {:0.2f} priority {} jitter {:0.2f}s, {:0.2f}s since last checked".format(
now - watch['last_checked'])) uuid,
watch['last_checked'],
now,
priority,
watch.jitter_seconds,
now - watch['last_checked']))
# Into the queue with you # Into the queue with you
update_q.put((5, uuid)) update_q.put((priority, uuid))
# Reset for next time # Reset for next time
watch.jitter_seconds = 0 watch.jitter_seconds = 0

Loading…
Cancel
Save