hanami-events-cloud_pubsub 3.2.0 → 3.2.1

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: ce3a1788cccaf44d604f113f700ffe69b2e198d068b6dce7ed25f85bc1c2f72a
4
- data.tar.gz: 0cbbe24fb26de4fc989dcfc53f2cb73fccaacc58408deaae623d1d6d7e249ba2
3
+ metadata.gz: cedb970c9a8160f1d3b1e1c41dd87b5bfb8d35cb29872694af944110f681b7fc
4
+ data.tar.gz: 277273b17749ba058a545f1caadc3819688964c9fccaaf34a1774b7445f4b86f
5
5
  SHA512:
6
- metadata.gz: 9789652777e1a651533eab9c0f68a418815ce7694b2888e4d6e01ffb0d2b8f5099cea2dbd9903fc6abb8c82b547f7107fcc3ce8356396414baa443335b2bc021
7
- data.tar.gz: 585fc1954bc4431f5770f1eb7fb8d659c22f28726e69ecc60bdd4751e9a627de1e2f5321e142a04222a46c03d18d08aa5a6304102d8dd976b48ba0fb09aef770
6
+ metadata.gz: 2f76c43c7a07b590e9c9f6b7e8839d5ab37266c4b353099bfc1a872308db646c5a4421a3185c13e20d55a80e7a67242fac975824b29de4f0afee51a6af1e2d6f
7
+ data.tar.gz: af41acad939eabcf399b7f7936b54a99f173a00da497991929de64ebb00dbd3b0da8f48f917dfc1f8b818227671744631b6d6e260c4706c4a901086d479d1f1f
@@ -93,7 +93,7 @@ module Hanami
93
93
  end
94
94
 
95
95
  def logger
96
- CloudPubsub.logger
96
+ Hanami::Events::CloudPubsub.logger
97
97
  end
98
98
 
99
99
  def setup_signal_handlers
@@ -42,7 +42,7 @@ module Hanami
42
42
 
43
43
  def register
44
44
  subscription = subscription_for(subscriber_id)
45
- apply_retry_options(subscription)
45
+ apply_subscription_options(subscription)
46
46
  listener = subscription.listen(**subscriber_options) { |m| handle_message(m) }
47
47
  logger.debug("Registered listener for #{subscriber_id} with: #{subscriber_options}")
48
48
 
@@ -135,21 +135,38 @@ module Hanami
135
135
  }
136
136
  end
137
137
 
138
- def apply_retry_options(sub)
139
- retry_policy = build_retry_policy
138
+ def apply_subscription_options(sub)
139
+ apply_deadline_options(sub)
140
+ apply_retry_options(sub)
141
+ apply_dead_letter_options(sub)
142
+ rescue StandardError => e
143
+ run_error_handlers(e, nil)
144
+ end
145
+
146
+ def apply_deadline_options(sub)
147
+ sub.deadline = subscriber_options[:deadline] if sub.deadline != subscriber_options[:deadline]
148
+ rescue StandardError => e
149
+ run_error_handlers(e, nil)
150
+ end
151
+
152
+ def apply_dead_letter_options(sub)
140
153
  attempts = CloudPubsub.config.auto_retry.max_attempts
141
154
 
142
- sub.retry_policy = retry_policy if sub.retry_policy&.to_grpc != retry_policy&.to_grpc
143
155
  sub.dead_letter_topic = dead_letter_topic if sub.dead_letter_topic&.name != dead_letter_topic&.name
144
156
  sub.dead_letter_max_delivery_attempts = attempts if sub.dead_letter_topic&.name != dead_letter_topic&.name
157
+ rescue StandardError => e
158
+ run_error_handlers(e, nil)
159
+ end
145
160
 
146
- sub
161
+ def apply_retry_options(sub)
162
+ retry_policy = build_retry_policy
163
+ sub.retry_policy = retry_policy if sub.retry_policy&.to_grpc != retry_policy&.to_grpc
147
164
  rescue StandardError => e
148
165
  run_error_handlers(e, nil)
149
166
  end
150
167
 
151
168
  def build_retry_policy
152
- return unless CloudPubsub.config.auto_retry.enabled
169
+ return unless Hanami::Events::CloudPubsub.config.auto_retry.enabled
153
170
 
154
171
  Google::Cloud::PubSub::RetryPolicy.new(
155
172
  minimum_backoff: CloudPubsub.config.auto_retry.minimum_backoff,
@@ -3,7 +3,7 @@
3
3
  module Hanami
4
4
  module Events
5
5
  module CloudPubsub
6
- VERSION = '3.2.0'
6
+ VERSION = '3.2.1'
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.2.0
4
+ version: 3.2.1
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: 2021-04-21 00:00:00.000000000 Z
11
+ date: 2021-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable