circuitry 3.1.2 → 3.1.3

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: 4bc47aba6103b9002f8ebb2bf01d117f70886734
4
- data.tar.gz: 196235821765465563e4024ca84ffdd7c1073840
3
+ metadata.gz: 1f3c99a64adc915007123a1956871036f326888b
4
+ data.tar.gz: 8e87c4341121bbee53f2eab1de36a3ac7c946f00
5
5
  SHA512:
6
- metadata.gz: ec1fd3a9ec9a9439017ccb71ce08910de261630ca1b7e49cbe309271260cebf2fde55e6a232ab57e63e9567594440f657fc2ff29e52d46cd92ce2f55d916670a
7
- data.tar.gz: 9e401d50cfbc1c3a3f17219410f6b88da1653e7ce850969bafef5784d321c3274df29c5642df5ec7e9eb6f7bbc9da7da5058693601ba839f5dcf05ddcd11e3f9
6
+ metadata.gz: 1109edbb48c25e003d4b1ecd0254d955cd5dd47109414064cedc2bc4fc8af45b11b0f962a04de15dbb8960df8368efb6f379058d053cfa6d3801418cc31da4a4
7
+ data.tar.gz: 81416baf0e0e6090230081ae0577670bb36ec1740e85ed1ba752475532b88fe329f8045a36c58d2ba1ad9e28c9dd0dc6202cc5770a5bab17fd83dd4250477fa2
@@ -1,3 +1,7 @@
1
+ ## Circuitry 3.1.3 (Mar 23, 2016)
2
+
3
+ * Added retries for message publishing if there's an SNS connection failure. *Matt Huggins*
4
+
1
5
  ## Circuitry 3.1.2 (Mar 4, 2016)
2
6
 
3
7
  * Reimplemented subscriber-only flush middleware. *Matt Huggins*
@@ -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 { publish_internal(topic_name, message) }
39
+ process_asynchronously { publish_message(topic_name, message) }
36
40
  else
37
- publish_internal(topic_name, message)
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 publish_internal(topic_name, message)
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
- topic = Topic.find(topic_name)
55
- sns.publish(topic_arn: topic.arn, message: message)
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
@@ -1,3 +1,3 @@
1
1
  module Circuitry
2
- VERSION = '3.1.2'
2
+ VERSION = '3.1.3'
3
3
  end
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.2
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-04 00:00:00.000000000 Z
12
+ date: 2016-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk