google-cloud-pubsub 1.0.1 → 1.0.2

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: 0f7dff11d651ad06ca607807388398bbdd150faceaa33b55f12b558159bf3cdf
4
- data.tar.gz: 915d9e6a4df2c3def14acc478d4348c5f1a6e7c1d96e5aea5b191f4ed83d2752
3
+ metadata.gz: 8d3c2b3976af69e59bdb1ea9653f42164db682ce28a929b5325d760c46bab4aa
4
+ data.tar.gz: 0f922862ba91d39e1ba8f55a66d2a6699392157ed850e129ed127dc9f63ac1d5
5
5
  SHA512:
6
- metadata.gz: 9dfe9bdd8e1fe239444c5f2a0d3710558cf1ac249e6445a6374896a23b12143ead53e4c437a2dc79750a7630f62a0f6f6541b24499a56070895000da1d3502ca
7
- data.tar.gz: a71c2a9bc381c633ad976205423c28688afd0d914bef94814e49b7fa881861f186b9761bd6461c8e910e7d793dd264e2ed2f3a7d4294f214727c90c75ca8c125
6
+ metadata.gz: d33fdcdb157fa0795e6fc28517ccdd26b8b03b3380dd96bd6f931063eae3ac30a5c4d3b5e9dafd32bbc93ee76e4db3544611c4b1ac9a63ad6068422c9bab466e
7
+ data.tar.gz: b8218aceaa79d35777e540a43764e7e49474e5dc393c508384f12e4dff09e7d5e1470a8d5a9f2ed6bf96c17d54c63be8489aefbf32babccfeb57a15035867521
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Release History
2
2
 
3
+ ### 1.0.2 / 2019-10-10
4
+
5
+ #### Bug Fixes
6
+
7
+ * Fix Subscriber state after releasing messages
8
+ * Correctly reset the Subscriber state when releasing messages
9
+ after the callback either raises an error, or the callback
10
+ fails to call acknowledge or modify_ack_deadline on the
11
+ message. If a Subscriber fills it's inventory, and stops
12
+ pulling additional messages before all the callbacks are
13
+ completed (moves to a paused state) then the Subscriber
14
+ could become stuck in a paused state.
15
+ * A paused Subscriber will now check whether to unpause after
16
+ the callback is completed, instead of when acknowledge or
17
+ modify_ack_deadline is called on the message.
18
+
3
19
  ### 1.0.1 / 2019-10-01
4
20
 
5
21
  #### Bug Fixes
@@ -472,7 +472,7 @@ module Google
472
472
  end
473
473
 
474
474
  def inspect
475
- "#{self.class}(#{@project})"
475
+ "#<#{self.class.name} #{@project}>"
476
476
  end
477
477
 
478
478
  protected
@@ -292,8 +292,8 @@ module Google
292
292
  ##
293
293
  # @private
294
294
  def to_s
295
- format "(subscription: %<sub>s, streams: %<count>i)",
296
- sub: subscription_name, count: streams
295
+ "(subscription: #{subscription_name}, " \
296
+ "streams: [#{stream_pool.map(&:to_s).join(', ')}])"
297
297
  end
298
298
 
299
299
  ##
@@ -123,7 +123,6 @@ module Google
123
123
  synchronize do
124
124
  @inventory.remove ack_ids
125
125
  @subscriber.buffer.acknowledge ack_ids
126
- unpause_streaming!
127
126
  end
128
127
 
129
128
  true
@@ -138,12 +137,27 @@ module Google
138
137
  synchronize do
139
138
  @inventory.remove mod_ack_ids
140
139
  @subscriber.buffer.modify_ack_deadline deadline, mod_ack_ids
141
- unpause_streaming!
142
140
  end
143
141
 
144
142
  true
145
143
  end
146
144
 
145
+ ##
146
+ # @private
147
+ def release *messages
148
+ ack_ids = coerce_ack_ids messages
149
+ return if ack_ids.empty?
150
+
151
+ synchronize do
152
+ # Remove from inventory if the message was not explicitly acked or
153
+ # nacked in the callback
154
+ @inventory.remove ack_ids
155
+ # Check whether to unpause the stream only after the callback is
156
+ # completed and the thread is being reclaimed.
157
+ unpause_streaming!
158
+ end
159
+ end
160
+
147
161
  def push request
148
162
  synchronize { @request_queue.push request }
149
163
  end
@@ -168,8 +182,8 @@ module Google
168
182
 
169
183
  # @private
170
184
  def to_s
171
- format "(inventory: %<inv>i, status: %<sts>s)",
172
- inv: inventory.count, sts: status
185
+ "(inventory: #{@inventory.count}, " \
186
+ "status: #{status}, thread: #{thread_status})"
173
187
  end
174
188
 
175
189
  # @private
@@ -279,7 +293,7 @@ module Google
279
293
  rescue StandardError => callback_error
280
294
  stream.subscriber.error! callback_error
281
295
  ensure
282
- stream.inventory.remove msg.ack_id
296
+ stream.release msg
283
297
  end
284
298
  end
285
299
  end
@@ -342,6 +356,12 @@ module Google
342
356
  end
343
357
 
344
358
  def status
359
+ return "stopped" if stopped?
360
+ return "paused" if paused?
361
+ "running"
362
+ end
363
+
364
+ def thread_status
345
365
  return "not started" if @background_thread.nil?
346
366
 
347
367
  status = @background_thread.status
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "1.0.1".freeze
19
+ VERSION = "1.0.2".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: 1.0.1
4
+ version: 1.0.2
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: 2019-10-01 00:00:00.000000000 Z
12
+ date: 2019-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core