Skip to content

Commit

Permalink
Fix empty response on sqs dequeue (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfriedlizuehlke authored Nov 20, 2023
1 parent 602b3d0 commit a833364
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions polytope_server/common/queue/sqs_queue.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import json
import logging
from . import queue

import boto3

from ..metric_collector import SQSQueueMetricCollector
from . import queue


class SQSQueue(queue.Queue):
Expand Down Expand Up @@ -30,7 +32,7 @@ def dequeue(self):
VisibilityTimeout=self.visibility_timeout, # If processing takes more seconds, message will be read twice
MaxNumberOfMessages=1,
)
if not response["Messages"]:
if "Messages" not in response:
return None

msg, *remainder = response["Messages"]
Expand Down

0 comments on commit a833364

Please sign in to comment.