Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added total_messages

  • Loading branch information...
commit 14c97590eb54641516df171b5a4a030f1335712e 1 parent 763bb26
rkononov authored
Showing with 13 additions and 2 deletions.
  1. +9 −1 lib/iron_mq/queues.rb
  2. +4 −1 test/test_iron_mq.rb
View
10 lib/iron_mq/queues.rb
@@ -60,7 +60,15 @@ def size
return @size if @size
q = @queues.get(:name=>name)
@size = q.size
- return @size
+ @size
+ end
+
+ def total_messages
+ return raw["total_messages"] if raw["total_messages"]
+ return @total_messages if @total_messages
+ q = @queues.get(:name=>name)
+ @total_messages = q.total_messages
+ @total_messages
end
# def delete
View
5 test/test_iron_mq.rb
@@ -20,6 +20,9 @@ def test_basics
@client.queue_name = 'test_basics'
clear_queue
+ queue = @client.queues.get(:name=>@client.queue_name)
+ total_messages = queue.total_messages
+
res = @client.messages.post("hello world!")
p res
assert res["id"]
@@ -28,7 +31,7 @@ def test_basics
queue = @client.queues.get(:name=>@client.queue_name)
assert queue.size == 1
-
+ assert queue.total_messages == (total_messages+1)
res = @client.messages.get()
p res
assert res["id"]
Please sign in to comment.
Something went wrong with that request. Please try again.