From 4a66720969596805a7cf39207c1032c98bd2dbf2 Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Mon, 13 Jul 2015 09:59:08 -0400 Subject: [PATCH] release lock for 1 device --- poller-service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/poller-service.py b/poller-service.py index e57f8f7aeb..e64c9800b5 100755 --- a/poller-service.py +++ b/poller-service.py @@ -201,7 +201,7 @@ dev_query = ('SELECT device_id, ' 'AND IS_FREE_LOCK(CONCAT("polling.", device_id)) ' 'AND IS_FREE_LOCK(CONCAT("queued.", device_id)) ' 'AND last_poll_attempted < DATE_SUB( ' - ' NOW(), INTERVAL {2} SECOND ) ' + ' NOW(), INTERVAL {2} SECOND ) ' '{3} ' 'ORDER BY next_poll asc ').format(poll_frequency, discover_frequency, @@ -268,6 +268,10 @@ while True: t = threading.Thread(target=poll_worker, args=[device_id, action]) t.start() + # If there is only one device, release the queue lock, because it won't release automatically. + if len(devices) == 1: + releaseLock('queued.{}'.format(device_id)) + # If we made it this far, break out of the loop and query again. break