carnivore-sqs 0.1.12 → 0.1.14

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: 90900f0e587b869635641f3493b4e2031b7e3ff8
4
- data.tar.gz: e4a842b6be117d1ae0f2ab253af9463b0d32285f
3
+ metadata.gz: d236b2198a13087cecaa8f0839cdee9e90b4feef
4
+ data.tar.gz: c20b469e06ddfb0e58e2e156413532be05f7419b
5
5
  SHA512:
6
- metadata.gz: cfe06781991be9396a122455632d93f40c9c1b8e6574e399a276b3f64162470a8a01fbd199c012fb4c29368cb69cdabe4b9d0f36ee3bfc1b3827b9125cb023be
7
- data.tar.gz: 1a92cefa9d3018bdf4a54b39307e47751008dd28d61f1ed5948de046b6e5d212d685f7780ef851a5c4c2b1635241642940796f36dd3a6e63800e44b074ab73e0
6
+ metadata.gz: 0aeec2cefefac492fa19e0cefb904b8b05d63599cf79ec78d3d944985c696d6eb9391468e430a78ce80e4ce340a1343732e003d4449c72a6f7cf8b54e0c1eaf2
7
+ data.tar.gz: bf869723fbde8600f8e6bb2fd7420276733ef1df174173ca7712c5a2105e10d074f70241b37137ccbcb819509d77bfc7afc97a7ca48b8ae9e611a6277c8fa43a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # v0.1.14
2
+ * Fix storage of updated queue when format applied on setup
3
+
1
4
  # v0.1.12
2
5
  * Feature: Add #touch support
3
6
 
Binary file
@@ -21,14 +21,15 @@ module Carnivore
21
21
  @queues.size.times.map(&:to_i).zip(@queues).flatten
22
22
  )]
23
23
  end
24
- @queues.values.map! do |q|
25
- format_queue(q)
26
- end
24
+ @queues = Hash[
25
+ @queues.each do |k,v|
26
+ [k, format_queue(v)]
27
+ end
28
+ ]
27
29
  if(args[:processable_queues])
28
30
  @processable_queues = Array(args[:processable_queues]).flatten.compact
29
31
  end
30
32
  @pause_time = args[:pause] || 5
31
- @receive_timeout = nil
32
33
  debug "Setup for SQS source instance <#{name}> complete"
33
34
  debug "Configured queues for handling: #{@queues.inspect}"
34
35
  end
@@ -51,16 +52,20 @@ module Carnivore
51
52
  end
52
53
 
53
54
  def receive(n=1)
54
- set_receive_timeout!
55
55
  count = 0
56
56
  msgs = []
57
57
  while(msgs.empty?)
58
58
  msgs = []
59
- @receive_timeout.reset
60
59
  msgs = queues.map do |q|
61
60
  begin
62
- m = @fog.receive_message(q, 'MaxNumberOfMessages' => n).body['Message']
63
- m.map{|mg| mg.merge('SourceQueue' => q)}
61
+ Timeout.timeout(args.fetch(:receive_timeout, 30).to_i) do
62
+ m = @fog.receive_message(q, 'MaxNumberOfMessages' => n).body['Message']
63
+ m.map{|mg| mg.merge('SourceQueue' => q)}
64
+ end
65
+ rescue Timeout::Error
66
+ error 'Receive timeout encountered. Triggering a reconnection.'
67
+ connect
68
+ retry
64
69
  rescue Excon::Errors::Error => e
65
70
  error "SQS received an unexpected error. Pausing and running retry (#{e.class}: #{e})"
66
71
  debug "SQS ERROR TRACE: #{e.class}: #{e}\n#{e.backtrace.join("\n")}"
@@ -68,7 +73,6 @@ module Carnivore
68
73
  retry
69
74
  end
70
75
  end.flatten.compact
71
- @receive_timeout.reset
72
76
  if(msgs.empty?)
73
77
  if(count == 0)
74
78
  debug "Source<#{name}> no message received. Sleeping for #{pause_time} seconds."
@@ -172,10 +176,6 @@ module Carnivore
172
176
  m
173
177
  end
174
178
 
175
- def set_receive_timeout!
176
- @receive_timeout ||= after(args[:receive_timeout] || 30){ connect }
177
- end
178
-
179
179
  end
180
180
  end
181
181
  end
@@ -1,5 +1,5 @@
1
1
  module Carnivore
2
2
  module Sqs
3
- VERSION = Gem::Version.new('0.1.12')
3
+ VERSION = Gem::Version.new('0.1.14')
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carnivore-sqs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-14 00:00:00.000000000 Z
11
+ date: 2015-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carnivore
@@ -48,6 +48,7 @@ files:
48
48
  - CONTRIBUTING.md
49
49
  - LICENSE
50
50
  - README.md
51
+ - carnivore-sqs-0.1.12.gem
51
52
  - carnivore-sqs.gemspec
52
53
  - lib/carnivore-sqs.rb
53
54
  - lib/carnivore-sqs/sqs.rb