Skip to content

Commit f7e46f6

Browse files
authored
Merge pull request #21 from cuda-networks/removing_warnings
removing warnings on non-existent queue for dynamic queues
2 parents e26ad1f + a21e670 commit f7e46f6

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

eb_sqs/worker/service.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import logging
77

88
from botocore.config import Config
9+
from botocore.exceptions import ClientError
910
from django.utils import timezone
1011

1112
from eb_sqs import settings
@@ -59,10 +60,10 @@ def process_queues(self, queue_names):
5960
))
6061

6162
logger.debug('[django-eb-sqs] Processing {} queues'.format(len(queues)))
62-
self.process_messages(queues, worker)
63+
self.process_messages(queues, worker, static_queues)
6364

64-
def process_messages(self, queues, worker):
65-
# type: (list, Worker) -> None
65+
def process_messages(self, queues, worker, static_queues):
66+
# type: (list, Worker, list) -> None
6667
for queue in queues:
6768
try:
6869
messages = self.poll_messages(queue)
@@ -78,6 +79,12 @@ def process_messages(self, queues, worker):
7879
})
7980

8081
self.delete_messages(queue, msg_entries)
82+
except ClientError as exc:
83+
error_code = exc.response.get('Error', {}).get('Code', None)
84+
if error_code == 'AWS.SimpleQueueService.NonExistentQueue' and queue not in static_queues:
85+
logger.debug('[django-eb-sqs] Queue was already deleted {}: {}'.format(queue.url, exc), exc_info=1)
86+
else:
87+
logger.warning('[django-eb-sqs] Error polling queue {}: {}'.format(queue.url, exc), exc_info=1)
8188
except Exception as exc:
8289
logger.warning('[django-eb-sqs] Error polling queue {}: {}'.format(queue.url, exc), exc_info=1)
8390

0 commit comments

Comments
 (0)