Skip to content

Commit 3ef04ec

Browse files
committed
PR review comments
1 parent 2dcce5a commit 3ef04ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

eb_sqs/worker/service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class WorkerService(object):
3030
def process_queues(self, queue_names):
3131
# type: (list) -> None
3232
self.write_healthcheck_file()
33+
self.last_healthcheck_time = timezone.now()
3334

3435
logger.debug('[django-eb-sqs] Connecting to SQS: {}'.format(', '.join(queue_names)))
3536

@@ -76,7 +77,6 @@ def process_queues(self, queue_names):
7677

7778
def process_messages(self, queues, worker, static_queues):
7879
# type: (list, Worker, list) -> None
79-
last_healthcheck_time = timezone.now()
8080

8181
for queue in queues:
8282
try:
@@ -99,9 +99,9 @@ def process_messages(self, queues, worker, static_queues):
9999

100100
self._send_signal(MESSAGES_DELETED, messages=messages)
101101

102-
if timezone.now() - timedelta(seconds=settings.MIN_HEALTHCHECK_WRITE_PERIOD_S) > last_healthcheck_time:
102+
if timezone.now() - timedelta(seconds=settings.MIN_HEALTHCHECK_WRITE_PERIOD_S) > self.last_healthcheck_time:
103103
self.write_healthcheck_file()
104-
last_healthcheck_time = timezone.now()
104+
self.last_healthcheck_time = timezone.now()
105105
except ClientError as exc:
106106
error_code = exc.response.get('Error', {}).get('Code', None)
107107
if error_code == 'AWS.SimpleQueueService.NonExistentQueue' and queue not in static_queues:

0 commit comments

Comments
 (0)