Skip to content

Commit

Permalink
Merge pull request #135 from meedan/cv2-5639-sleepy-time-2
Browse files Browse the repository at this point in the history
CV2-5639 use direct poll waiter in SQS
DGaffney authored Dec 3, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 63b65d6 + f541fa1 commit 8270381
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/queue/queue.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import time
from typing import List, Dict, Tuple
import os
import threading
@@ -171,8 +170,7 @@ def receive_messages(self, batch_size: int = 1):
Receive messages from a queue.
"""
queue = self.get_or_create_queue(self.input_queue_name)[0]
time.sleep(0.5)
return [(m, self.input_queue_name) for m in queue.receive_messages(MaxNumberOfMessages=min(batch_size, SQS_MAX_BATCH_SIZE))]
return [(m, self.input_queue_name) for m in queue.receive_messages(MaxNumberOfMessages=min(batch_size, SQS_MAX_BATCH_SIZE), WaitTimeoutSeconds=20)]

def find_queue_by_name(self, queue_name: str) -> boto3.resources.base.ServiceResource:
"""

0 comments on commit 8270381

Please sign in to comment.