eventq_rabbitmq 1.7.9 → 1.7.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c67f200ec80b84e8851066d2c3e56a9342e1e13f
|
4
|
+
data.tar.gz: b71b02f7fa301a2c6defad9748a9df57345bb32c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 604c29e6c72cbcbb98bd5059d1f36d6194f7d6d658e7ec5a795b9485053285ed486a41387dc1e634e1235537097bd61c22a8f7d5de3543cfdc901938a4c09930
|
7
|
+
data.tar.gz: 3d9f83ee5a49a9b86bcd86546834c744ab8f4aaaace4af7c13b1076cf49740ba3e5d0a00e5ac5c1006aa60dc89f3353d0254525035ab4b8969c0c08917664183
|
@@ -29,9 +29,9 @@ module EventQ
|
|
29
29
|
:user => @user,
|
30
30
|
:pass => @password,
|
31
31
|
:ssl => @ssl,
|
32
|
-
:read_timeout =>
|
33
|
-
:heartbeat =>
|
34
|
-
:continuation_timeout =>
|
32
|
+
:read_timeout => 4,
|
33
|
+
:heartbeat => 20,
|
34
|
+
:continuation_timeout => 5000,
|
35
35
|
:automatically_recover => true,
|
36
36
|
:network_recovery_interval => 1,
|
37
37
|
:recover_from_connection_close => true
|
@@ -67,8 +67,6 @@ module EventQ
|
|
67
67
|
manager = EventQ::RabbitMq::QueueManager.new
|
68
68
|
manager.durable = options[:durable]
|
69
69
|
|
70
|
-
@connection = client.get_connection
|
71
|
-
|
72
70
|
@threads = []
|
73
71
|
|
74
72
|
#loop through each thread count
|
@@ -83,11 +81,14 @@ module EventQ
|
|
83
81
|
break
|
84
82
|
end
|
85
83
|
|
84
|
+
has_processed = false
|
85
|
+
|
86
86
|
begin
|
87
87
|
|
88
|
-
|
88
|
+
connection = client.get_connection
|
89
|
+
channel = connection.create_channel
|
89
90
|
|
90
|
-
thread_process_iteration(channel, manager, queue, block)
|
91
|
+
has_processed = thread_process_iteration(channel, manager, queue, block)
|
91
92
|
|
92
93
|
rescue => e
|
93
94
|
EventQ.logger.error "An unhandled error occurred attempting to communicate with RabbitMQ. Error: #{e} | Backtrace: #{e.backtrace}"
|
@@ -97,6 +98,15 @@ module EventQ
|
|
97
98
|
channel.close
|
98
99
|
end
|
99
100
|
|
101
|
+
if connection != nil
|
102
|
+
connection.close
|
103
|
+
end
|
104
|
+
|
105
|
+
if !has_processed
|
106
|
+
EventQ.log(:debug, "[#{self.class}] - Sleeping for #{@sleep} seconds")
|
107
|
+
sleep(@sleep)
|
108
|
+
end
|
109
|
+
|
100
110
|
end
|
101
111
|
|
102
112
|
end
|
@@ -164,23 +174,21 @@ module EventQ
|
|
164
174
|
EventQ.log(:error, "[#{self.class}] - An error occurred attempting to pop a message from the queue. Error: #{e} | Backtrace: #{e.backtrace}")
|
165
175
|
end
|
166
176
|
|
167
|
-
channel.close
|
168
|
-
|
169
177
|
GC.start
|
170
178
|
|
171
179
|
#check if any message was received
|
172
180
|
if !received && !error
|
173
|
-
EventQ.log(:debug, "[#{self.class}] - No message received.
|
174
|
-
|
175
|
-
sleep(@sleep)
|
181
|
+
EventQ.log(:debug, "[#{self.class}] - No message received.")
|
182
|
+
return false
|
176
183
|
end
|
184
|
+
|
185
|
+
return true
|
177
186
|
end
|
178
187
|
|
179
188
|
def stop
|
180
189
|
puts "[#{self.class}] - Stopping..."
|
181
190
|
@is_running = false
|
182
191
|
@threads.each { |thr| thr.join }
|
183
|
-
@connection.close
|
184
192
|
return true
|
185
193
|
end
|
186
194
|
|