google-cloud-pubsub 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ad1e392a28fae7f97e78f0e5a73fcccb4cef83462b7ff6caac53c4e450cbf91
4
- data.tar.gz: 0d71eca6ba2b40ddb7d1855b2ea9bd4c75422aed74cc2f008cee1881fc850c43
3
+ metadata.gz: 24eb8350951100fd325571412067861f44eab7575cadd16a8daee35ebf8f26ae
4
+ data.tar.gz: ae3c0aef696e531b2f5bfb61bbff09f4f50e4c42e62d94b027b38a620858aa88
5
5
  SHA512:
6
- metadata.gz: 4ff13cb0796a1fff747785b078ead8f2c0e71d56cfabdaed4156b83eb5bb800c8e35fbc84a4e722f51df8602ff6ca8b81ddfbeac51ada0eb0c7029e5258467d8
7
- data.tar.gz: '058a56e42f9f42366f709c86f1efe2cec8d1fe909ae2097ac2e7dc9a1e061376636bb7d109711ded9d84284c48b05bf739707b592e500ae8671fda76d22bbf88'
6
+ metadata.gz: 7103a23c4129c14745401b84e41f6522518d6c64b0a89871c2af1bca4464d6883304a7e752411d35bf2bc2e3a877b3cbffc3afffed71df935cb98a3ee696a347
7
+ data.tar.gz: 425057b02a2ced62a0e55db13eddd0c67f377d4a34b98f90d225cc79a1261c99afb9bb7b67f96198c8d183af7708c9f15b409e5fa73c8cdbf96176e6efb441dd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Release History
2
2
 
3
+ ### 2.6.1 / 2021-04-28
4
+
5
+ #### Bug Fixes
6
+
7
+ * Add final flush of pending requests to Subscriber#wait!
8
+ * fix(pubsub): Add final flush of pending requests to Subscriber#wait!
9
+
3
10
  ### 2.6.0 / 2021-04-19
4
11
 
5
12
  #### Features
@@ -128,28 +128,21 @@ module Google
128
128
 
129
129
  ##
130
130
  # Immediately stops the subscriber. No new messages will be pulled from
131
- # the subscription. All actions taken on received messages that have not
132
- # yet been sent to the API will be sent to the API. All received but
133
- # unprocessed messages will be released back to the API and redelivered.
134
- # Use {#wait!} to block until the subscriber is fully stopped and all
135
- # received messages have been processed or released.
131
+ # the subscription. Use {#wait!} to block until all received messages have
132
+ # been processed or released: All actions taken on received messages that
133
+ # have not yet been sent to the API will be sent to the API. All received
134
+ # but unprocessed messages will be released back to the API and redelivered.
136
135
  #
137
136
  # @return [Subscriber] returns self so calls can be chained.
138
137
  #
139
138
  def stop
140
- stop_pool = synchronize do
139
+ synchronize do
141
140
  @started = false
142
141
  @stopped = true
143
-
144
- @stream_pool.map do |stream|
145
- Thread.new { stream.stop }
146
- end
142
+ @stream_pool.map(&:stop)
143
+ wait_stop_buffer_thread!
144
+ self
147
145
  end
148
- stop_pool.map(&:join)
149
- # Stop the buffer after the streams are all stopped
150
- synchronize { @buffer.stop }
151
-
152
- self
153
146
  end
154
147
 
155
148
  ##
@@ -167,13 +160,8 @@ module Google
167
160
  # @return [Subscriber] returns self so calls can be chained.
168
161
  #
169
162
  def wait! timeout = nil
170
- wait_pool = synchronize do
171
- @stream_pool.map do |stream|
172
- Thread.new { stream.wait! timeout }
173
- end
174
- end
175
- wait_pool.map(&:join)
176
-
163
+ wait_stop_buffer_thread!
164
+ @wait_stop_buffer_thread.join timeout
177
165
  self
178
166
  end
179
167
 
@@ -379,6 +367,18 @@ module Google
379
367
 
380
368
  protected
381
369
 
370
+ ##
371
+ # Starts a new thread to call wait! (blocking) on each Stream and then stop the TimedUnaryBuffer.
372
+ def wait_stop_buffer_thread!
373
+ synchronize do
374
+ @wait_stop_buffer_thread ||= Thread.new do
375
+ @stream_pool.map(&:wait!)
376
+ # Shutdown the buffer TimerTask (and flush the buffer) after the streams are all stopped.
377
+ @buffer.stop
378
+ end
379
+ end
380
+ end
381
+
382
382
  def coerce_inventory inventory
383
383
  @inventory = inventory
384
384
  if @inventory.is_a? Hash
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "2.6.0".freeze
19
+ VERSION = "2.6.1".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.6.0
4
+ version: 2.6.1
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: 2021-04-19 00:00:00.000000000 Z
12
+ date: 2021-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  - !ruby/object:Gem::Version
276
276
  version: '0'
277
277
  requirements: []
278
- rubygems_version: 3.2.13
278
+ rubygems_version: 3.2.16
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: API Client library for Google Cloud Pub/Sub