hanami-events-cloud_pubsub 3.0.4 → 3.0.5

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
  SHA256:
3
- metadata.gz: aee0ba4911c74d444d15ac8a68be7b29f6545bac4b5a3f334b82e7227c36f428
4
- data.tar.gz: 1d04b3640314ab6cd95dcffe2c2e7e8f7d43c757ca7d82d47b012ffd2f5230b3
3
+ metadata.gz: 3d44039a04524e3577341b8dce78ee4479b24b49972d9be9e5353ac8e1186b4c
4
+ data.tar.gz: 84546314a907e147de4fbbcce02ec85e802c089e7ec2ed5b242e76bc53b63839
5
5
  SHA512:
6
- metadata.gz: 88b2756beaf9b141768e60d119298bd2723882bf931000ffbf4ac81f1db5bfde8fab8458fcf25b92e9d4623538d6d7ef521116a511da2ea8545f6ee0e7741fdc
7
- data.tar.gz: a059d2529907d76bc6f5be1c0e9f5298b5d883aef43e645a8b4d3ac6401bf00c8440fea93a8d924f2f06223ff93ff7c67588e4588a9a4a93baf84da2f01971e5
6
+ metadata.gz: 63555a20d775ee80b5841991b4a2e3176d63e55e447f318a3ffed81f115790ba7e9149c1a170c2fc53b5f03d26dcbd3de679b7c513074213495f193b2960d19f
7
+ data.tar.gz: 3a21d8e97f431bca8b24cbffb2f09428cc743ff68f85225a0b71435f20196583e390e39c42bf6f1c9d425504ca9324b28310807bb631ddc8caed86a494a22960
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-09-25 19:54:44 UTC using RuboCop version 0.89.0.
3
+ # on 2020-12-08 03:28:27 UTC using RuboCop version 0.89.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -15,13 +15,23 @@ Lint/RedundantCopDisableDirective:
15
15
  # Offense count: 3
16
16
  # Configuration parameters: IgnoredMethods.
17
17
  Metrics/AbcSize:
18
- Max: 21
18
+ Max: 25
19
+
20
+ # Offense count: 1
21
+ # Configuration parameters: IgnoredMethods.
22
+ Metrics/CyclomaticComplexity:
23
+ Max: 11
19
24
 
20
25
  # Offense count: 4
21
26
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
22
27
  Metrics/MethodLength:
23
28
  Max: 14
24
29
 
30
+ # Offense count: 1
31
+ # Configuration parameters: IgnoredMethods.
32
+ Metrics/PerceivedComplexity:
33
+ Max: 11
34
+
25
35
  # Offense count: 1
26
36
  # Configuration parameters: AllowedVariables.
27
37
  Style/GlobalVars:
@@ -8,7 +8,7 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- hanami-events-cloud_pubsub (3.0.4)
11
+ hanami-events-cloud_pubsub (3.0.5)
12
12
  dry-configurable (>= 0.8)
13
13
  gapic-common (>= 0.3.4)
14
14
  google-cloud-pubsub (>= 0.38.1, < 2.4)
@@ -52,7 +52,7 @@ module Hanami
52
52
  }, reader: true
53
53
  setting :error_handlers, [
54
54
  ->(err, msg) do
55
- logger.error "Message(#{msg.message_id}) failed with exception #{err.inspect}"
55
+ logger.error "Message(#{msg}) failed with exception #{err.inspect}"
56
56
  end
57
57
  ], reader: true
58
58
 
@@ -87,7 +87,7 @@ module Hanami
87
87
  middleware.invoke(message) { handler.call(message) }
88
88
  message.ack!
89
89
  rescue StandardError => e
90
- run_error_handlers(e, message)
90
+ run_error_handlers(e, message.message_id.to_s)
91
91
  message.nack! if CloudPubsub.config.auto_retry.enabled
92
92
  raise
93
93
  end
@@ -133,18 +133,25 @@ module Hanami
133
133
  end
134
134
 
135
135
  def apply_retry_options(sub)
136
- return {} unless CloudPubsub.config.auto_retry.enabled
136
+ retry_policy = build_retry_policy
137
+ attempts = CloudPubsub.config.auto_retry.max_attempts
137
138
 
138
- sub.retry_policy = Google::Cloud::PubSub::RetryPolicy.new(
139
- minimum_backoff: CloudPubsub.config.auto_retry.minimum_backoff,
140
- maximum_backoff: CloudPubsub.config.auto_retry.maximum_backoff
141
- )
142
- sub.dead_letter_topic = dead_letter_topic
143
- sub.dead_letter_max_delivery_attempts = CloudPubsub.config.auto_retry.max_attempts
139
+ sub.retry_policy = retry_policy if sub.retry_policy&.to_grpc != retry_policy&.to_grpc
140
+ sub.dead_letter_topic = dead_letter_topic if sub.dead_letter_topic&.name != dead_letter_topic&.name
141
+ sub.dead_letter_max_delivery_attempts = attempts if sub.dead_letter_topic&.name != dead_letter_topic&.name
144
142
 
145
143
  sub
146
144
  rescue StandardError => e
147
- run_error_handlers(e, "Faled to apply retry options (see https://github.com/googleapis/google-cloud-ruby/issues/8237)")
145
+ run_error_handlers(e, nil)
146
+ end
147
+
148
+ def build_retry_policy
149
+ return unless CloudPubsub.config.auto_retry.enabled
150
+
151
+ Google::Cloud::PubSub::RetryPolicy.new(
152
+ minimum_backoff: CloudPubsub.config.auto_retry.minimum_backoff,
153
+ maximum_backoff: CloudPubsub.config.auto_retry.maximum_backoff
154
+ )
148
155
  end
149
156
  end
150
157
  # rubocop:enable Metrics/ClassLength:
@@ -3,7 +3,7 @@
3
3
  module Hanami
4
4
  module Events
5
5
  module CloudPubsub
6
- VERSION = '3.0.4'
6
+ VERSION = '3.0.5'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-events-cloud_pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-06 00:00:00.000000000 Z
11
+ date: 2020-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable