eventq_aws 1.5.1 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2d351facd07b1bb4cf1008a99ed0c97437e6998
4
- data.tar.gz: f92c24c19f8e8d8c51d9824b703cc64a791cd69d
3
+ metadata.gz: a3a4f844b9f491cfebb6546c0a1dcfbafc907339
4
+ data.tar.gz: 9319dca6a682b2e18652522c33e1371248fb12b8
5
5
  SHA512:
6
- metadata.gz: 2ef160d8087df0b6ea1fc148b62cf144ba167c4d55071ded4abfb226c08cb06017e2f2a03a9ff4b7d1cd271810ce93133d78eb4b932bb3cc826f11a5dc091b0b
7
- data.tar.gz: 07c0c07c428dbeed274f157fed4e6fc04d17dcfb487a28e6cd32623d1e0f791aea6fe7632cdda971b532a9544abecc2c2fd226c0af5c7bdfd5271fa67e962aac
6
+ metadata.gz: a65b40297c1e4c0413aa8c9644ee23b708d7f32bee9b5fdf3e8f88aa7c722f4d6e2ebef41d088ca5ccc8d81251461604f21a8a55611ff16c941541da2febd1b2
7
+ data.tar.gz: 57db8ddc7162af56300c6b1d1333e14cb5d773b2e95a3b52c2583c6b976e7704b703d7d836f7dbd7b5ea08bb06bc5ace5e504c9d8c30711cc9905810567a8223
@@ -86,13 +86,16 @@ module EventQ
86
86
  break
87
87
  end
88
88
 
89
- has_processed = thread_process_iteration(client, manager, queue, block)
89
+ has_message_received = thread_process_iteration(client, manager, queue, block)
90
90
 
91
91
  gc_flush
92
92
 
93
- if !has_processed && @sleep > 0
94
- EventQ.log(:debug, "[#{self.class}] - Sleeping for #{@sleep} seconds")
95
- sleep(@sleep)
93
+ if !has_message_received
94
+ EventQ.log(:debug, "[#{self.class}] - No message received.")
95
+ if @sleep > 0
96
+ EventQ.log(:debug, "[#{self.class}] - Sleeping for #{@sleep} seconds")
97
+ sleep(@sleep)
98
+ end
96
99
  end
97
100
 
98
101
  end
@@ -124,7 +127,6 @@ module EventQ
124
127
  q = manager.get_queue(queue)
125
128
 
126
129
  received = false
127
- error = false
128
130
 
129
131
  begin
130
132
 
@@ -138,12 +140,10 @@ module EventQ
138
140
 
139
141
  #check that a message was received
140
142
  if response.messages.length > 0
143
+ received = true
141
144
  begin
142
145
  tag_processing_thread
143
- process_message(response, client, queue, q, block) do |received, error|
144
- received = received
145
- error = error
146
- end
146
+ process_message(response, client, queue, q, block)
147
147
  ensure
148
148
  untag_processing_thread
149
149
  end
@@ -154,13 +154,7 @@ module EventQ
154
154
  EventQ.log(:error, "[#{self.class}] - An error occurred attempting to retrieve a message from the queue. Error: #{e.backtrace}")
155
155
  end
156
156
 
157
- #check if any message was received
158
- if !received
159
- EventQ.log(:debug, "[#{self.class}] - No message received.")
160
- return false
161
- end
162
-
163
- return true
157
+ return received
164
158
  end
165
159
 
166
160
  def stop
@@ -186,7 +180,6 @@ module EventQ
186
180
  private
187
181
 
188
182
  def process_message(response, client, queue, q, block)
189
- abort = false
190
183
  msg = response.messages[0]
191
184
  retry_attempts = msg.attributes[APPROXIMATE_RECEIVE_COUNT].to_i - 1
192
185
 
@@ -209,13 +202,11 @@ module EventQ
209
202
  block.call(message.content, message_args)
210
203
 
211
204
  if message_args.abort == true
212
- abort = true
213
205
  EventQ.log(:info, "[#{self.class}] - Message aborted.")
214
206
  else
215
207
  #accept the message as processed
216
208
  client.sqs.delete_message({ queue_url: q, receipt_handle: msg.receipt_handle })
217
209
  EventQ.log(:info, "[#{self.class}] - Message acknowledged.")
218
- received = true
219
210
  end
220
211
 
221
212
  rescue => e
@@ -225,7 +216,7 @@ module EventQ
225
216
 
226
217
  end
227
218
 
228
- if abort || error
219
+ if message_args.abort || error
229
220
  EventQ::NonceManager.failed(message.id)
230
221
  EventQ.log(:info, "[#{self.class}] - Message rejected.")
231
222
  reject_message(queue, client, msg, q, retry_attempts)
@@ -233,8 +224,6 @@ module EventQ
233
224
  EventQ::NonceManager.complete(message.id)
234
225
  end
235
226
 
236
- yield [received, error]
237
-
238
227
  return true
239
228
  end
240
229
 
@@ -1,5 +1,5 @@
1
1
  module EventQ
2
2
  module Amazon
3
- VERSION = "1.5.1"
3
+ VERSION = "1.5.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventq_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-11 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler