From 9931d9dc442d0f3d4a1f2a2a29504f40ceec0a0b Mon Sep 17 00:00:00 2001 From: Clint Armstrong Date: Mon, 13 Jul 2015 14:32:00 -0400 Subject: [PATCH] don't try to discover down devices --- poller-service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poller-service.py b/poller-service.py index 7f94f1423..e9aa123bc 100755 --- a/poller-service.py +++ b/poller-service.py @@ -183,7 +183,7 @@ poller_group = ('and poller_group IN({}) ' # Add last_polled and last_polled_timetaken so we can sort by the time the last poll started, with the goal # of having each device complete a poll within the given time range. -dev_query = ('SELECT device_id, ' +dev_query = ('SELECT device_id, status, ' 'DATE_ADD( ' ' DATE_SUB( ' ' last_polled, ' @@ -251,7 +251,7 @@ while True: sys.exit(2) devices = cursor.fetchall() - for device_id, next_poll, next_discovery in devices: + for device_id, status, next_poll, next_discovery in devices: # add queue lock, so we lock the next device against any other pollers # if this fails, the device is locked by another poller already if not getLock('queued.{}'.format(device_id)): @@ -267,7 +267,7 @@ while True: sleep_until(next_poll) action = 'poll' - if not next_discovery or next_discovery < datetime.now(): + if (not next_discovery or next_discovery < datetime.now()) and status == 1: action = 'discovery' log.debug('DEBUG: Starting {} of device {}'.format(action, device_id))