hanami-events-cloud_pubsub 3.0.0 → 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: fd0a13431ee107060d1d5df6dac57392e421053f13e58dc9d7144bb01008be12
4
- data.tar.gz: d71e132eee40d004bf01827de7b5782ae1ca77b909fd884288bb0fc84f6d9a30
3
+ metadata.gz: 3d44039a04524e3577341b8dce78ee4479b24b49972d9be9e5353ac8e1186b4c
4
+ data.tar.gz: 84546314a907e147de4fbbcce02ec85e802c089e7ec2ed5b242e76bc53b63839
5
5
  SHA512:
6
- metadata.gz: 5740b2f509eca29b70870b32adf7508bdc776a9d2efea0c41540fef600d26464eed902752b8095d5e3f028a04a08d5b13f7bc4b8ad313d24c008b96973542a8e
7
- data.tar.gz: e75c53c924ab42ca5db76d02217e2e2f82ce83f1ae6e63e85640cfab894380282bca5bad9deeabb64970d88d2788ceaf5aec09999af4d8e8342ec5eac46180fe
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,10 +8,10 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- hanami-events-cloud_pubsub (3.0.0)
11
+ hanami-events-cloud_pubsub (3.0.5)
12
12
  dry-configurable (>= 0.8)
13
13
  gapic-common (>= 0.3.4)
14
- google-cloud-pubsub (>= 0.38.1, < 2.1)
14
+ google-cloud-pubsub (>= 0.38.1, < 2.4)
15
15
  hanami-cli (~> 0.2)
16
16
  hanami-events (~> 0.2.0)
17
17
  rack
@@ -36,8 +36,9 @@ GEM
36
36
  dry-core (0.4.9)
37
37
  concurrent-ruby (~> 1.0)
38
38
  dry-equalizer (0.3.0)
39
- faraday (1.0.1)
39
+ faraday (1.1.0)
40
40
  multipart-post (>= 1.2, < 3)
41
+ ruby2_keywords
41
42
  gapic-common (0.3.4)
42
43
  google-protobuf (~> 3.12, >= 3.12.2)
43
44
  googleapis-common-protos (>= 1.3.9, < 2.0)
@@ -47,10 +48,10 @@ GEM
47
48
  google-cloud-core (1.5.0)
48
49
  google-cloud-env (~> 1.0)
49
50
  google-cloud-errors (~> 1.0)
50
- google-cloud-env (1.3.3)
51
+ google-cloud-env (1.4.0)
51
52
  faraday (>= 0.17.3, < 2.0)
52
53
  google-cloud-errors (1.0.1)
53
- google-cloud-pubsub (2.0.0)
54
+ google-cloud-pubsub (2.3.0)
54
55
  concurrent-ruby (~> 1.1)
55
56
  google-cloud-core (~> 1.5)
56
57
  google-cloud-pubsub-v1 (~> 0.0)
@@ -58,21 +59,21 @@ GEM
58
59
  gapic-common (~> 0.3)
59
60
  google-cloud-errors (~> 1.0)
60
61
  grpc-google-iam-v1 (>= 0.6.10, < 2.0)
61
- google-protobuf (3.13.0)
62
+ google-protobuf (3.14.0)
62
63
  googleapis-common-protos (1.3.10)
63
64
  google-protobuf (~> 3.11)
64
65
  googleapis-common-protos-types (>= 1.0.5, < 2.0)
65
66
  grpc (~> 1.27)
66
67
  googleapis-common-protos-types (1.0.5)
67
68
  google-protobuf (~> 3.11)
68
- googleauth (0.13.1)
69
+ googleauth (0.14.0)
69
70
  faraday (>= 0.17.3, < 2.0)
70
71
  jwt (>= 1.4, < 3.0)
71
72
  memoist (~> 0.16)
72
73
  multi_json (~> 1.11)
73
74
  os (>= 0.9, < 2.0)
74
75
  signet (~> 0.14)
75
- grpc (1.32.0)
76
+ grpc (1.34.0)
76
77
  google-protobuf (~> 3.13)
77
78
  googleapis-common-protos-types (~> 1.0)
78
79
  grpc-google-iam-v1 (0.6.10)
@@ -130,6 +131,7 @@ GEM
130
131
  rubocop-ast (0.3.0)
131
132
  parser (>= 2.7.1.4)
132
133
  ruby-progressbar (1.10.1)
134
+ ruby2_keywords (0.0.2)
133
135
  signet (0.14.0)
134
136
  addressable (~> 2.3)
135
137
  faraday (>= 0.17.3, < 2.0)
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency 'dry-configurable', '>= 0.8'
28
28
  spec.add_dependency 'gapic-common', '>= 0.3.4'
29
- spec.add_dependency 'google-cloud-pubsub', '>= 0.38.1', '< 2.1'
29
+ spec.add_dependency 'google-cloud-pubsub', '>= 0.38.1', '< 2.4'
30
30
  spec.add_dependency 'hanami-cli', '~> 0.2'
31
31
  spec.add_dependency 'hanami-events', '~> 0.2.0'
32
32
  spec.add_dependency 'rack'
@@ -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
 
@@ -85,11 +85,11 @@ module Hanami
85
85
 
86
86
  def run_handler(message)
87
87
  middleware.invoke(message) { handler.call(message) }
88
+ message.ack!
88
89
  rescue StandardError => e
89
- run_error_handlers(e, message)
90
- raise
91
- ensure
90
+ run_error_handlers(e, message.message_id.to_s)
92
91
  message.nack! if CloudPubsub.config.auto_retry.enabled
92
+ raise
93
93
  end
94
94
 
95
95
  def subscription_for(name)
@@ -133,16 +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
138
+
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
142
+
143
+ sub
144
+ rescue StandardError => e
145
+ run_error_handlers(e, nil)
146
+ end
147
+
148
+ def build_retry_policy
149
+ return unless CloudPubsub.config.auto_retry.enabled
137
150
 
138
- sub.retry_policy = Google::Cloud::PubSub::RetryPolicy.new(
151
+ Google::Cloud::PubSub::RetryPolicy.new(
139
152
  minimum_backoff: CloudPubsub.config.auto_retry.minimum_backoff,
140
153
  maximum_backoff: CloudPubsub.config.auto_retry.maximum_backoff
141
154
  )
142
- sub.dead_letter_topic = dead_letter_topic
143
- sub.dead_letter_max_delivery_attempts = CloudPubsub.config.auto_retry.max_attempts
144
-
145
- sub
146
155
  end
147
156
  end
148
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.0'
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.0
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-09-25 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
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: 0.38.1
48
48
  - - "<"
49
49
  - !ruby/object:Gem::Version
50
- version: '2.1'
50
+ version: '2.4'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: 0.38.1
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
- version: '2.1'
60
+ version: '2.4'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: hanami-cli
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  - !ruby/object:Gem::Version
224
224
  version: '0'
225
225
  requirements: []
226
- rubygems_version: 3.1.2
226
+ rubygems_version: 3.0.3
227
227
  signing_key:
228
228
  specification_version: 4
229
229
  summary: Google Cloud Pub/Sub adapter for the hanami-events gem