Skip to content

Commit

Permalink
Revert "first pass using get_queue_by_name"
Browse files Browse the repository at this point in the history
This reverts commit 7ff9ab6.
  • Loading branch information
computermacgyver committed Nov 13, 2024
1 parent 7ff9ab6 commit f08180b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/queue/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self):
Start a specific queue - must pass input_queue_name.
"""
self.sqs_lock = Lock()
# self.sqs = self.get_sqs() # Remove this over concerns that it could be stale
self.sqs = self.get_sqs()

@staticmethod
def get_queue_prefix():
Expand Down Expand Up @@ -82,7 +82,7 @@ def create_queue(self, queue_name: str) -> boto3.resources.base.ServiceResource:
# Optionally enable content-based deduplication for FIFO queues
attributes['ContentBasedDeduplication'] = 'true'
# Include other FIFO-specific attributes as needed
return self.get_sqs().create_queue(
return self.sqs.create_queue(
QueueName=queue_name,
Attributes=attributes
)
Expand All @@ -92,10 +92,9 @@ def get_or_create_queues(self, queue_name: str) -> List[boto3.resources.base.Ser
Initialize all queues for the given worker - try to create them if they are not found by name for whatever reason
"""
try:
# found_queues = [q for q in self.get_sqs().queues.filter(QueueNamePrefix=queue_name)]
# logger.info(f"found queues are {found_queues}")
# exact_match_queues = [queue for queue in found_queues if queue.attributes['QueueArn'].split(':')[-1] == queue_name]
exact_match_queues = [self.get_sqs().get_queue_by_name(QueueName=queue_name)]
found_queues = [q for q in self.sqs.queues.filter(QueueNamePrefix=queue_name)]
exact_match_queues = [queue for queue in found_queues if queue.attributes['QueueArn'].split(':')[-1] == queue_name]
logger.info(f"found queues are {found_queues}")
logger.info(f"exact queues are {exact_match_queues}")
if exact_match_queues:
return exact_match_queues
Expand Down

0 comments on commit f08180b

Please sign in to comment.