google-cloud-pubsub 0.39.3 → 1.0.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: 73f7842ab38615304cdae95c371eb8afea6bc4299208ba3ae4c61e4db85356ba
4
- data.tar.gz: 6b0e30cf14ee025dc2abdb7bcbfb7424fe93952c9dfc24a9cd01837a7a813621
3
+ metadata.gz: 0e249c4539610e4b293e64f0e61319712f2d7cd68197aca32158387873962c6d
4
+ data.tar.gz: 1abcfc9704a1d17035fcf1c79a65a41fb3a0406621bd80d60fb8bf40e402f2ab
5
5
  SHA512:
6
- metadata.gz: 7e343262355396ae126ac9945df4a89f7af156f9f6a4ea7f31581eceee691f875595235fed0e3d2800b5b49aea46e61fe528db32f35c10c42f3b3c738e5608c1
7
- data.tar.gz: edcdc80a74455127b8817a5aa2cf9b95c5a057a37fe5e9e6f15fa2f5da90ad4fa16290548a07311ed15df719c88cfa4e87b350047e769137f4d8215bcc6015be
6
+ metadata.gz: dd0fd7eba6866ae2893d3d4efdd23d32f37793ed64b43f9ee27755e26ae13d79d95f1782fb246bea4ce9c5ed36747789d07c92d3bd578d8dd04471aa905b6953
7
+ data.tar.gz: 0b0edaae2cf9304c0af750fd3e0e0d7989f846f284a3498eb9c476e9139fda649f24c55fc877286b0f614de949b877bd14062519470dbd91aeabb81425a44b0d
@@ -1,5 +1,16 @@
1
1
  # Release History
2
2
 
3
+ ### 1.0.0 / 2019-09-30
4
+
5
+ #### Features
6
+
7
+ * Allow wait to block for specified time
8
+ * Add timeout argument to Subscriber#wait! method.
9
+ * Document timeout argument on AsyncPublisher#wait! method.
10
+ * Add stop! convenience method, calling both stop and wait
11
+ * Add Subscriber#stop! method.
12
+ * Add AsyncPublisher#stop! method.
13
+
3
14
  ### 0.39.3 / 2019-09-27
4
15
 
5
16
  #### Bug Fixes
@@ -136,10 +136,15 @@ module Google
136
136
  end
137
137
 
138
138
  ##
139
- # Blocks until the publisher is fully stopped, all pending messages
140
- # have been published, and all callbacks have completed. Does not stop
141
- # the publisher. To stop the publisher, first call {#stop} and then
142
- # call {#wait!} to block until the publisher is stopped.
139
+ # Blocks until the publisher is fully stopped, all pending messages have
140
+ # been published, and all callbacks have completed, or until `timeout`
141
+ # seconds have passed.
142
+ #
143
+ # Does not stop the publisher. To stop the publisher, first call {#stop}
144
+ # and then call {#wait!} to block until the publisher is stopped
145
+ #
146
+ # @param [Number, nil] timeout The number of seconds to block until the
147
+ # publisher is fully stopped. Default will block indefinitely.
143
148
  #
144
149
  # @return [AsyncPublisher] returns self so calls can be chained.
145
150
  def wait! timeout = nil
@@ -157,6 +162,22 @@ module Google
157
162
  self
158
163
  end
159
164
 
165
+ ##
166
+ # Stop this publisher and block until the publisher is fully stopped,
167
+ # all pending messages have been published, and all callbacks have
168
+ # completed, or until `timeout` seconds have passed.
169
+ #
170
+ # The same as calling {#stop} and {#wait!}.
171
+ #
172
+ # @param [Number, nil] timeout The number of seconds to block until the
173
+ # publisher is fully stopped. Default will block indefinitely.
174
+ #
175
+ # @return [AsyncPublisher] returns self so calls can be chained.
176
+ def stop! timeout = nil
177
+ stop
178
+ wait! timeout
179
+ end
180
+
160
181
  ##
161
182
  # Forces all messages in the current batch to be published
162
183
  # immediately.
@@ -149,17 +149,21 @@ module Google
149
149
 
150
150
  ##
151
151
  # Blocks until the subscriber is fully stopped and all received messages
152
- # have been processed or released.
152
+ # have been processed or released, or until `timeout` seconds have
153
+ # passed.
153
154
  #
154
155
  # Does not stop the subscriber. To stop the subscriber, first call
155
156
  # {#stop} and then call {#wait!} to block until the subscriber is
156
157
  # stopped.
157
158
  #
159
+ # @param [Number, nil] timeout The number of seconds to block until the
160
+ # subscriber is fully stopped. Default will block indefinitely.
161
+ #
158
162
  # @return [Subscriber] returns self so calls can be chained.
159
- def wait!
163
+ def wait! timeout = nil
160
164
  wait_pool = synchronize do
161
165
  @stream_pool.map do |stream|
162
- Thread.new { stream.wait! }
166
+ Thread.new { stream.wait! timeout }
163
167
  end
164
168
  end
165
169
  wait_pool.map(&:join)
@@ -167,6 +171,23 @@ module Google
167
171
  self
168
172
  end
169
173
 
174
+ ##
175
+ # Stop this subscriber and block until the subscriber is fully stopped
176
+ # and all received messages have been processed or released, or until
177
+ # `timeout` seconds have passed.
178
+ #
179
+ # The same as calling {#stop} and {#wait!}.
180
+ #
181
+ # @param [Number, nil] timeout The number of seconds to block until the
182
+ # subscriber is fully stopped. Default will block indefinitely.
183
+ #
184
+ # @return [Subscriber] returns self so calls can be chained.
185
+ #
186
+ def stop! timeout = nil
187
+ stop
188
+ wait! timeout
189
+ end
190
+
170
191
  ##
171
192
  # Whether the subscriber has been started.
172
193
  #
@@ -107,9 +107,9 @@ module Google
107
107
  synchronize { @paused }
108
108
  end
109
109
 
110
- def wait!
110
+ def wait! timeout = nil
111
111
  # Wait for all queued callbacks to be processed.
112
- @callback_thread_pool.wait_for_termination
112
+ @callback_thread_pool.wait_for_termination timeout
113
113
 
114
114
  self
115
115
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module PubSub
19
- VERSION = "0.39.3".freeze
19
+ VERSION = "1.0.0".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: 0.39.3
4
+ version: 1.0.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: 2019-09-27 00:00:00.000000000 Z
12
+ date: 2019-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core