google-cloud-pubsub 2.9.2 → 2.10.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfea48d152ed64a8f424def3c0ecdbdc7458da875f12d9ca72aa04a61a682c8c
|
4
|
+
data.tar.gz: b19ac0708ab621f94c90e76fa9819ebd06ef4c4d4afd158b5da185dea5cfbb65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccb470b1228bbb234000c74f05396cbfcfe89780557962d4fa5268ad32a164627a48d0a45f605c6cbccdae2944cdf6f6829cb6310c73a0b0fc9de32495a565f4
|
7
|
+
data.tar.gz: 4dbce7523618c04e64ba84231bc9cfce06b9c16026a18c51c451337a7db851c122e47f0e1cc3d07a841ec4fcdd67a1b6ee338c888721b3e77db3b18a9f34948b
|
data/CHANGELOG.md
CHANGED
@@ -35,16 +35,18 @@ module Google
|
|
35
35
|
attr_reader :bytesize
|
36
36
|
attr_reader :extension
|
37
37
|
attr_reader :max_duration_per_lease_extension
|
38
|
+
attr_accessor :min_duration_per_lease_extension
|
38
39
|
attr_reader :use_legacy_flow_control
|
39
40
|
|
40
41
|
def initialize stream, limit:, bytesize:, extension:, max_duration_per_lease_extension:,
|
41
|
-
use_legacy_flow_control:
|
42
|
+
min_duration_per_lease_extension:, use_legacy_flow_control:
|
42
43
|
super()
|
43
44
|
@stream = stream
|
44
45
|
@limit = limit
|
45
46
|
@bytesize = bytesize
|
46
47
|
@extension = extension
|
47
48
|
@max_duration_per_lease_extension = max_duration_per_lease_extension
|
49
|
+
@min_duration_per_lease_extension = min_duration_per_lease_extension
|
48
50
|
@use_legacy_flow_control = use_legacy_flow_control
|
49
51
|
@inventory = {}
|
50
52
|
@wait_cond = new_cond
|
@@ -162,6 +164,8 @@ module Google
|
|
162
164
|
def calc_delay
|
163
165
|
delay = (stream.subscriber.deadline - 3) * rand(0.8..0.9)
|
164
166
|
delay = [delay, max_duration_per_lease_extension].min if max_duration_per_lease_extension.positive?
|
167
|
+
delay = [delay, min_duration_per_lease_extension].max if min_duration_per_lease_extension.positive? &&
|
168
|
+
stream.exactly_once_delivery_enabled
|
165
169
|
delay
|
166
170
|
end
|
167
171
|
end
|
@@ -46,6 +46,10 @@ module Google
|
|
46
46
|
# @private Sequencer.
|
47
47
|
attr_reader :sequencer
|
48
48
|
|
49
|
+
##
|
50
|
+
# @private exactly_once_delivery_enabled.
|
51
|
+
attr_reader :exactly_once_delivery_enabled
|
52
|
+
|
49
53
|
##
|
50
54
|
# @private Create an empty Subscriber::Stream object.
|
51
55
|
def initialize subscriber
|
@@ -57,6 +61,7 @@ module Google
|
|
57
61
|
@stopped = nil
|
58
62
|
@paused = nil
|
59
63
|
@pause_cond = new_cond
|
64
|
+
@exactly_once_delivery_enabled = false
|
60
65
|
|
61
66
|
@inventory = Inventory.new self, **@subscriber.stream_inventory
|
62
67
|
|
@@ -242,9 +247,13 @@ module Google
|
|
242
247
|
begin
|
243
248
|
# Cannot syncronize the enumerator, causes deadlock
|
244
249
|
response = enum.next
|
250
|
+
new_exactly_once_delivery_enabled = response&.subscription_properties&.exactly_once_delivery_enabled
|
245
251
|
|
246
|
-
# Use synchronize so
|
252
|
+
# Use synchronize so changes happen atomically
|
247
253
|
synchronize do
|
254
|
+
update_min_duration_per_lease_extension new_exactly_once_delivery_enabled
|
255
|
+
@exactly_once_delivery_enabled = new_exactly_once_delivery_enabled unless new_exactly_once_delivery_enabled.nil?
|
256
|
+
|
248
257
|
# Create receipt of received messages reception
|
249
258
|
@subscriber.buffer.modify_ack_deadline @subscriber.deadline, response.received_messages.map(&:ack_id)
|
250
259
|
|
@@ -285,6 +294,14 @@ module Google
|
|
285
294
|
|
286
295
|
# rubocop:enable all
|
287
296
|
|
297
|
+
# Updates min_duration_per_lease_extension to 60 when exactly_once_delivery_enabled
|
298
|
+
# and reverts back to default 0 when disabled.
|
299
|
+
# Skips if exactly_once_enabled is not modified.
|
300
|
+
def update_min_duration_per_lease_extension new_exactly_once_delivery_enabled
|
301
|
+
return if new_exactly_once_delivery_enabled == @exactly_once_delivery_enabled
|
302
|
+
@inventory.min_duration_per_lease_extension = new_exactly_once_delivery_enabled ? 60 : 0
|
303
|
+
end
|
304
|
+
|
288
305
|
def register_callback rec_msg
|
289
306
|
if @sequencer
|
290
307
|
# Add the message to the sequencer to invoke the callback.
|
@@ -331,6 +331,16 @@ module Google
|
|
331
331
|
@inventory[:max_duration_per_lease_extension]
|
332
332
|
end
|
333
333
|
|
334
|
+
##
|
335
|
+
# The minimum amount of time in seconds for a single lease extension attempt. Bounds the delay before a message
|
336
|
+
# redelivery if the subscriber fails to extend the deadline. Default is 0 (disabled).
|
337
|
+
#
|
338
|
+
# @return [Integer] The minimum number of seconds.
|
339
|
+
#
|
340
|
+
def min_duration_per_lease_extension
|
341
|
+
@inventory[:min_duration_per_lease_extension]
|
342
|
+
end
|
343
|
+
|
334
344
|
##
|
335
345
|
# @private
|
336
346
|
def stream_inventory
|
@@ -339,6 +349,7 @@ module Google
|
|
339
349
|
bytesize: @inventory[:max_outstanding_bytes].fdiv(@streams).ceil,
|
340
350
|
extension: @inventory[:max_total_lease_duration],
|
341
351
|
max_duration_per_lease_extension: @inventory[:max_duration_per_lease_extension],
|
352
|
+
min_duration_per_lease_extension: @inventory[:min_duration_per_lease_extension],
|
342
353
|
use_legacy_flow_control: @inventory[:use_legacy_flow_control]
|
343
354
|
}
|
344
355
|
end
|
@@ -394,6 +405,7 @@ module Google
|
|
394
405
|
@inventory[:max_outstanding_bytes] = Integer(@inventory[:max_outstanding_bytes] || 100_000_000)
|
395
406
|
@inventory[:max_total_lease_duration] = Integer(@inventory[:max_total_lease_duration] || 3600)
|
396
407
|
@inventory[:max_duration_per_lease_extension] = Integer(@inventory[:max_duration_per_lease_extension] || 0)
|
408
|
+
@inventory[:min_duration_per_lease_extension] = Integer(@inventory[:min_duration_per_lease_extension] || 0)
|
397
409
|
@inventory[:use_legacy_flow_control] = @inventory[:use_legacy_flow_control] || false
|
398
410
|
end
|
399
411
|
|
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.
|
4
|
+
version: 2.10.0
|
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: 2022-
|
12
|
+
date: 2022-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -276,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
276
276
|
- !ruby/object:Gem::Version
|
277
277
|
version: '0'
|
278
278
|
requirements: []
|
279
|
-
rubygems_version: 3.3.
|
279
|
+
rubygems_version: 3.3.14
|
280
280
|
signing_key:
|
281
281
|
specification_version: 4
|
282
282
|
summary: API Client library for Google Cloud Pub/Sub
|