mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-17 14:37:54 +08:00
SQS only supports max 10 messages in bulk mode
* capped bulk at 10 * added tests
This commit is contained in:
@@ -16,6 +16,9 @@ class Sqs(Broker):
|
||||
return m.id
|
||||
|
||||
def dequeue(self):
|
||||
# sqs supports max 10 messages in bulk
|
||||
if Conf.BULK > 10:
|
||||
Conf.BULK = 10
|
||||
t = None
|
||||
if len(self.task_cache) > 0:
|
||||
t = self.task_cache.pop()
|
||||
|
||||
@@ -187,10 +187,10 @@ def test_sqs():
|
||||
task_id = broker.dequeue()[0]
|
||||
broker.fail(task_id)
|
||||
# bulk test
|
||||
for i in range(5):
|
||||
for i in range(10):
|
||||
broker.enqueue('test')
|
||||
Conf.BULK = 5
|
||||
for i in range(5):
|
||||
Conf.BULK = 12
|
||||
for i in range(10):
|
||||
task = broker.dequeue()
|
||||
assert task is not None
|
||||
broker.acknowledge(task[0])
|
||||
@@ -202,4 +202,5 @@ def test_sqs():
|
||||
broker.delete_queue()
|
||||
# back to django-redis
|
||||
Conf.SQS = None
|
||||
Conf.BULK = 1
|
||||
Conf.DJANGO_REDIS = 'default'
|
||||
|
||||
Reference in New Issue
Block a user