Skip to content

Commit

Permalink
Merge pull request #112 from Doist/proxi/fix-types
Browse files Browse the repository at this point in the history
chore: Improve types.
  • Loading branch information
proxi authored Aug 29, 2024
2 parents 44c54ea + c57568e commit 5b862c6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sqs_workers/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,13 @@ def process_batch(self, wait_seconds: int = 0) -> BatchProcessingResult:
wait_seconds, self.batching_policy.batch_size
)
success = self.process_messages(messages)
messages_with_success = ((m, success) for m in messages)
messages_with_success: Iterable[tuple[Any, bool]] = (
(m, success) for m in messages
)
else:
messages = self.get_raw_messages(wait_seconds)
success = [self.process_message(message) for message in messages]
messages_with_success = zip(messages, success)
successes = [self.process_message(message) for message in messages]
messages_with_success = zip(messages, successes)

return self._handle_processed(messages_with_success)

Expand Down Expand Up @@ -202,7 +204,7 @@ def get_raw_messages(self, wait_seconds: int, max_messages: int = 10) -> List[An
return queue.receive_messages(**kwargs)

messages_left_on_queue = True
received_messages = []
received_messages: list[Any] = []

# receive_messages will only return a maximum batch of 10 messages per call
# if the client requests more than that we must poll multiple times
Expand Down

0 comments on commit 5b862c6

Please sign in to comment.