From 8579fcaeea856c34ad050dcc835e44070512cc3e Mon Sep 17 00:00:00 2001 From: Christopher Usher Date: Mon, 28 Oct 2019 02:52:21 +0000 Subject: [PATCH] check start is not None before checking whether hour is before start --- backfiller/backfiller/main.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backfiller/backfiller/main.py b/backfiller/backfiller/main.py index 849787c..5a749ef 100644 --- a/backfiller/backfiller/main.py +++ b/backfiller/backfiller/main.py @@ -424,12 +424,13 @@ class BackfillerWorker(object): for hour in hours: # since backfilling can take a long time, recheck whether this # hour is after the start - if not isinstance(self.start, datetime.datetime): - start_hour = datetime.datetime.utcnow() - datetime.timedelta(hours=self.start) - else: - start_hour = self.start - if datetime.datetime.strptime(hour, HOUR_FMT) < start_hour: - break + if self.start is not None: + if not isinstance(self.start, datetime.datetime): + start_hour = datetime.datetime.utcnow() - datetime.timedelta(hours=self.start) + else: + start_hour = self.start + if datetime.datetime.strptime(hour, HOUR_FMT) < start_hour: + break self.logger.info('Backfilling {}/{}'.format(quality, hour))