circuitry 3.1.2 → 3.1.3
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/circuitry/publisher.rb +15 -5
- data/lib/circuitry/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: 1f3c99a64adc915007123a1956871036f326888b
|
4
|
+
data.tar.gz: 8e87c4341121bbee53f2eab1de36a3ac7c946f00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1109edbb48c25e003d4b1ecd0254d955cd5dd47109414064cedc2bc4fc8af45b11b0f962a04de15dbb8960df8368efb6f379058d053cfa6d3801418cc31da4a4
|
7
|
+
data.tar.gz: 81416baf0e0e6090230081ae0577670bb36ec1740e85ed1ba752475532b88fe329f8045a36c58d2ba1ad9e28c9dd0dc6202cc5770a5bab17fd83dd4250477fa2
|
data/CHANGELOG.md
CHANGED
data/lib/circuitry/publisher.rb
CHANGED
@@ -15,6 +15,10 @@ module Circuitry
|
|
15
15
|
timeout: 15
|
16
16
|
}.freeze
|
17
17
|
|
18
|
+
CONNECTION_ERRORS = [
|
19
|
+
Seahorse::Client::NetworkingError
|
20
|
+
].freeze
|
21
|
+
|
18
22
|
attr_reader :timeout
|
19
23
|
|
20
24
|
def initialize(options = {})
|
@@ -32,9 +36,9 @@ module Circuitry
|
|
32
36
|
message = object.to_json
|
33
37
|
|
34
38
|
if async?
|
35
|
-
process_asynchronously {
|
39
|
+
process_asynchronously { publish_message(topic_name, message) }
|
36
40
|
else
|
37
|
-
|
41
|
+
publish_message(topic_name, message)
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
@@ -44,15 +48,21 @@ module Circuitry
|
|
44
48
|
|
45
49
|
protected
|
46
50
|
|
47
|
-
def
|
51
|
+
def publish_message(topic_name, message)
|
48
52
|
middleware.invoke(topic_name, message) do
|
49
53
|
# TODO: Don't use ruby timeout.
|
50
54
|
# http://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/
|
51
55
|
Timeout.timeout(timeout) do
|
52
56
|
logger.info("Publishing message to #{topic_name}")
|
53
57
|
|
54
|
-
|
55
|
-
|
58
|
+
handler = ->(error, attempt_number, _total_delay) do
|
59
|
+
logger.warn("Error publishing attempt ##{attempt_number}: #{error.class} (#{error.message}); retrying...")
|
60
|
+
end
|
61
|
+
|
62
|
+
with_retries(max_tries: 3, handler: handler, rescue: CONNECTION_ERRORS, base_sleep_seconds: 0, max_sleep_seconds: 0) do
|
63
|
+
topic = Topic.find(topic_name)
|
64
|
+
sns.publish(topic_arn: topic.arn, message: message)
|
65
|
+
end
|
56
66
|
end
|
57
67
|
end
|
58
68
|
end
|
data/lib/circuitry/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circuitry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Huggins
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-03-
|
12
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|