qsagi 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qsagi/confirmed_queue.rb +14 -4
- data/lib/qsagi/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e63068ac04b6c2610b9074ca57bad759440561e
|
4
|
+
data.tar.gz: c4389fddd23a9f52af347bd57c429fda80fccb01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c1b947ae6081e99b830b696fe631d3694c640d6ed5819c9b94b3dde8d24e748675f7b27a26c9612cf934a017b42e87229473f12209a07e9b1c31cc7aa5bf9aa
|
7
|
+
data.tar.gz: c6e2aed327af4af1a98841a357e504c454b9fceed864e67b9ee6e85ab36c5f6a544f1461de6acbb4e27901b97413e53b56e0f33b0e16fe040f6502ebd351fb61
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'thread'
|
2
|
+
|
1
3
|
module Qsagi
|
2
4
|
class ConfirmedQueue
|
3
5
|
attr_reader :nacked_messages
|
@@ -7,6 +9,7 @@ module Qsagi
|
|
7
9
|
@nacked_messages = []
|
8
10
|
@unconfirmed_messages = {}
|
9
11
|
@wait_for_confirms = false
|
12
|
+
@semaphore = Mutex.new
|
10
13
|
end
|
11
14
|
|
12
15
|
def connect
|
@@ -19,7 +22,10 @@ module Qsagi
|
|
19
22
|
end
|
20
23
|
|
21
24
|
def push(message)
|
22
|
-
|
25
|
+
next_sequence_number = _channel.next_publish_seq_no
|
26
|
+
@semaphore.synchronize do
|
27
|
+
@unconfirmed_messages[next_sequence_number] = message
|
28
|
+
end
|
23
29
|
@queue.push(message)
|
24
30
|
@wait_for_confirms = true
|
25
31
|
end
|
@@ -54,9 +60,13 @@ module Qsagi
|
|
54
60
|
end
|
55
61
|
|
56
62
|
def _confirm_select
|
57
|
-
|
58
|
-
|
59
|
-
|
63
|
+
callback = lambda do |delivery_tag, multiple, is_nack|
|
64
|
+
@semaphore.synchronize do
|
65
|
+
_confirm_messages!(:delivery_tag => delivery_tag, :multiple => multiple, :is_nack => is_nack)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
_channel.confirm_select(callback)
|
60
70
|
end
|
61
71
|
|
62
72
|
def _wait_for_confirms?
|
data/lib/qsagi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qsagi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -94,3 +94,4 @@ test_files:
|
|
94
94
|
- spec/qsagi/message_spec.rb
|
95
95
|
- spec/qsagi/queue_spec.rb
|
96
96
|
- spec/spec_helper.rb
|
97
|
+
has_rdoc:
|