From 8de136f50c5eba0fcd1db903192770bcc7c6ce4f Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Wed, 9 Sep 2015 15:01:27 -0400 Subject: [PATCH] warn on empty queries --- poller-service.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/poller-service.py b/poller-service.py index 8cfa1ee40..fbf681c93 100755 --- a/poller-service.py +++ b/poller-service.py @@ -238,7 +238,12 @@ def poll_worker(thread_id): global devices_scanned db = DB() while True: - device_id, status, next_poll, next_discovery = db.query(dev_query)[0] + dev_row = db.query(dev_query) + if len(dev_row) < 1: + log.warning("WARNING: Thread {0} returned no devices from query".format(thread_id)) + continue + + device_id, status, next_poll, next_discovery = dev_row[0] if not getLock('queue.{0}'.format(device_id), db): continue