watership 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/watership/consumer.rb +11 -11
- data/lib/watership/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e68c5252d98d3bf463a4bd6796485624d3450c3
|
4
|
+
data.tar.gz: 5bb900d6db0d07207b082254b22efc8e29a2f89c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b8462e0e56e79fbd9d343d5dd00b5930768b7cab7a81ea95bd9358136f99584d3e9c00e2d26ef560d119733bb815a2ab52ff43857040badee3875bc1921255d
|
7
|
+
data.tar.gz: dce9f301810261e9001e6f25439df6c5bdd26a6c7ce0420d31549a74b85d34e6bf103f716c62b234615fb8a20ae380c020f45363e9beb854188cbadc206d613d
|
data/CHANGELOG.md
CHANGED
data/lib/watership/consumer.rb
CHANGED
@@ -5,7 +5,7 @@ module Watership
|
|
5
5
|
def initialize(consumer, url, channel_options = {}, queue_options = {})
|
6
6
|
@consumer = consumer
|
7
7
|
@url = url
|
8
|
-
@prefetch = channel_options.delete(:prefetch) ||
|
8
|
+
@prefetch = channel_options.delete(:prefetch) || Integer(ENV.fetch("RABBIT_CONSUMER_PREFETCH", 200))
|
9
9
|
@channel_opts = {durable: true}.merge(channel_options)
|
10
10
|
@queue_opts = {block: true, ack: true}.merge(queue_options)
|
11
11
|
end
|
@@ -19,28 +19,28 @@ module Watership
|
|
19
19
|
@consumer.call(JSON.parse(payload))
|
20
20
|
success = true
|
21
21
|
rescue StandardError => exception
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
Watership.logger.error "Error thrown in subscribe block"
|
23
|
+
Watership.logger.error exception.message
|
24
|
+
Watership.logger.error exception.backtrace.join("\n")
|
25
|
+
Watership.notify(exception)
|
26
|
+
Watership.logger.info "Rejecting in rabbit"
|
27
27
|
throw(:terminate)
|
28
28
|
rescue Interrupt => exception
|
29
|
-
|
30
|
-
|
29
|
+
Watership.logger.error "Interrupt in subscribe block"
|
30
|
+
Watership.logger.warn "Stopped gracefully."
|
31
31
|
throw(:terminate)
|
32
32
|
ensure
|
33
33
|
if success
|
34
|
-
|
34
|
+
Watership.logger.info "Acking message"
|
35
35
|
channel.acknowledge(delivery_info.delivery_tag, false)
|
36
36
|
else
|
37
|
-
|
37
|
+
Watership.logger.info "Rejecting message"
|
38
38
|
channel.reject(delivery_info.delivery_tag, true)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
42
|
ensure
|
43
|
-
|
43
|
+
Watership.logger.info "Closing Channel"
|
44
44
|
channel.close
|
45
45
|
end
|
46
46
|
end
|
data/lib/watership/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Scofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|