mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-23 00:18:11 +08:00
adds (approximate) lock_size to SQS broker
docs: added lock_size
This commit is contained in:
@@ -27,6 +27,9 @@ class Sqs(Broker):
|
||||
def queue_size(self):
|
||||
return int(self.queue.attributes['ApproximateNumberOfMessages'])
|
||||
|
||||
def lock_size(self):
|
||||
return int(self.queue.attributes['ApproximateNumberOfMessagesNotVisible'])
|
||||
|
||||
def delete(self, task_id):
|
||||
message = self.sqs.Message(self.queue.url, task_id)
|
||||
message.delete()
|
||||
|
||||
@@ -216,6 +216,7 @@ def test_sqs():
|
||||
broker.acknowledge(task[0])
|
||||
# duplicate acknowledge
|
||||
broker.acknowledge(task[0])
|
||||
assert broker.lock_size() == 0
|
||||
# delete queue
|
||||
broker.enqueue('test')
|
||||
broker.purge_queue()
|
||||
|
||||
@@ -129,6 +129,11 @@ You can override this class if you want to contribute and support your own broke
|
||||
|
||||
Returns the amount of messages in the brokers queue.
|
||||
|
||||
.. py:method:: lock_size()
|
||||
|
||||
Optional method that returns the number of messages currently awaiting acknowledgement.
|
||||
Only implemented on brokers that support it.
|
||||
|
||||
.. py:method:: ping()
|
||||
|
||||
Returns True if the broker can be reached.
|
||||
|
||||
Reference in New Issue
Block a user