google-cloud-pubsub 2.15.2 → 2.15.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
  SHA256:
3
- metadata.gz: b35d78bd1388f589340f93c8e9b9634e06a82406bfeb7cc134f3f9efe9126316
4
- data.tar.gz: 74c1c0be39fcabaed038750157e891da276e13bb5017c57cbb62ccf542139421
3
+ metadata.gz: b87b7780f67e6085a5385cead0cef00b28a2648838f62127077354e4a0f16ce9
4
+ data.tar.gz: c78f13b82c1482b32a71988acf62d76a9829806cdfcdfa5bff952764438c06f9
5
5
  SHA512:
6
- metadata.gz: 066db5f0cd5bdbd207cf8b928bab86dbb9438d7418ad0a596f07547738311ddb8ead880110e1464aeac7b6a90b44d9b54c36b86d3d873c623c866885c948e62f
7
- data.tar.gz: 51165f72d1a5813cae65c414915e907b9c15c8e6390ad9ba452b77a42cc6271d6d3b36fc62a97477bed12704d09d76993f0757c6cce8711c0f485eda0e5063f5
6
+ metadata.gz: be588f7f62da5e5e318674c40e1009e742120444e972fad475727936027b336801f2b8ae460be36c68d5912052d1fe5a577a100617aef31298d7d8312c6a000c
7
+ data.tar.gz: d79918f0b74eaaf5c393b72231e2d4162536ac0f18c8ac6eb8893d1b49dd0a68fd20e3c6ee8efcd5879a9b0aa7543948ce4c55d1532f58c7939d654b8b579dd1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 2.15.3 (2023-04-19)
4
+
5
+ #### Bug Fixes
6
+
7
+ * wait for successful receipt modack when exactly once delivery enabled ([#21431](https://github.com/googleapis/google-cloud-ruby/issues/21431))
8
+
3
9
  ### 2.15.2 (2023-03-19)
4
10
 
5
11
  #### Bug Fixes
@@ -248,6 +248,7 @@ module Google
248
248
  # Cannot syncronize the enumerator, causes deadlock
249
249
  response = enum.next
250
250
  new_exactly_once_delivery_enabled = response&.subscription_properties&.exactly_once_delivery_enabled
251
+ received_messages = response.received_messages
251
252
 
252
253
  # Use synchronize so changes happen atomically
253
254
  synchronize do
@@ -256,17 +257,21 @@ module Google
256
257
  @subscriber.exactly_once_delivery_enabled = @exactly_once_delivery_enabled
257
258
 
258
259
  # Create receipt of received messages reception
259
- @subscriber.buffer.modify_ack_deadline @subscriber.deadline, response.received_messages.map(&:ack_id)
260
-
261
- # Add received messages to inventory
262
- @inventory.add response.received_messages
260
+ if @exactly_once_delivery_enabled
261
+ create_receipt_modack_for_eos received_messages
262
+ else
263
+ @subscriber.buffer.modify_ack_deadline @subscriber.deadline, received_messages.map(&:ack_id)
264
+ # Add received messages to inventory
265
+ @inventory.add received_messages
266
+ end
263
267
  end
264
268
 
265
- response.received_messages.each do |rec_msg_grpc|
269
+ received_messages.each do |rec_msg_grpc|
266
270
  rec_msg = ReceivedMessage.from_grpc(rec_msg_grpc, self)
267
271
  # No need to synchronize the callback future
268
272
  register_callback rec_msg
269
- end
273
+ end if !@exactly_once_delivery_enabled # Exactly once delivery scenario is handled by callback
274
+
270
275
  synchronize { pause_streaming! }
271
276
  rescue StopIteration
272
277
  break
@@ -295,6 +300,19 @@ module Google
295
300
 
296
301
  # rubocop:enable all
297
302
 
303
+ def create_receipt_modack_for_eos received_messages
304
+ received_messages.each do |rec_msg_grpc|
305
+ callback = proc do |result|
306
+ if result.succeeded?
307
+ synchronize { @inventory.add rec_msg_grpc }
308
+ rec_msg = ReceivedMessage.from_grpc rec_msg_grpc, self
309
+ register_callback rec_msg
310
+ end
311
+ end
312
+ @subscriber.buffer.modify_ack_deadline @subscriber.deadline, [rec_msg_grpc.ack_id], callback
313
+ end
314
+ end
315
+
298
316
  # Updates min_duration_per_lease_extension to 60 when exactly_once_delivery_enabled
299
317
  # and reverts back to default 0 when disabled.
300
318
  # Skips if exactly_once_enabled is not modified.
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "2.15.2".freeze
19
+ VERSION = "2.15.3".freeze
20
20
  end
21
21
 
22
22
  Pubsub = PubSub unless const_defined? :Pubsub
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.2
4
+ version: 2.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Moore
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-03-20 00:00:00.000000000 Z
12
+ date: 2023-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby