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: 0249aa24e7036f041eb1ec1fd8e9fcd1d5a1331d
4
- data.tar.gz: b4887ed474c62e87804670ecd428469755bcbf1c
3
+ metadata.gz: c67f200ec80b84e8851066d2c3e56a9342e1e13f
4
+ data.tar.gz: b71b02f7fa301a2c6defad9748a9df57345bb32c
5
5
  SHA512:
6
- metadata.gz: 1fabf20d9fffe7f4e2e474edda40cf610ef823b95dfca966b171883be5f42c980492b38b6a4b60a96821c4e6b3485d62c30d3b00d50ea0b461e294c773fcba32
7
- data.tar.gz: 81cd6a969aedd1711d0ed7a677f457138185f5d7d1348d7d14ce006d7f1ac49792732d3acb7f086af9aa69effeece71ab97c16239f5a011a02b48c603cb9e02c
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 => 2,
33
- :heartbeat => 10,
34
- :continuation_timeout => 1000,
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
- channel = @connection.create_channel
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. Sleeping for #{@sleep} seconds")
174
- #no message received so sleep before attempting to pop another message from the queue
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
 
@@ -1,3 +1,3 @@
1
1
  module EventqRabbitmq
2
- VERSION = "1.7.9"
2
+ VERSION = "1.7.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventq_rabbitmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.9
4
+ version: 1.7.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage