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 +4 -4
- data/CHANGELOG.md +3 -0
- data/carnivore-sqs-0.1.12.gem +0 -0
- data/lib/carnivore-sqs/sqs.rb +13 -13
- data/lib/carnivore-sqs/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: d236b2198a13087cecaa8f0839cdee9e90b4feef
|
4
|
+
data.tar.gz: c20b469e06ddfb0e58e2e156413532be05f7419b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aeec2cefefac492fa19e0cefb904b8b05d63599cf79ec78d3d944985c696d6eb9391468e430a78ce80e4ce340a1343732e003d4449c72a6f7cf8b54e0c1eaf2
|
7
|
+
data.tar.gz: bf869723fbde8600f8e6bb2fd7420276733ef1df174173ca7712c5a2105e10d074f70241b37137ccbcb819509d77bfc7afc97a7ca48b8ae9e611a6277c8fa43a
|
data/CHANGELOG.md
CHANGED
Binary file
|
data/lib/carnivore-sqs/sqs.rb
CHANGED
@@ -21,14 +21,15 @@ module Carnivore
|
|
21
21
|
@queues.size.times.map(&:to_i).zip(@queues).flatten
|
22
22
|
)]
|
23
23
|
end
|
24
|
-
@queues
|
25
|
-
|
26
|
-
|
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
|
-
|
63
|
-
|
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
|
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.
|
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-
|
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
|