Skip to content

Conversation

@dhermes
Copy link
Contributor

@dhermes dhermes commented Dec 18, 2017

Unit tests will be coming in the next commit.

Fixes #4575.

@dhermes dhermes added the api: pubsub Issues related to the Pub/Sub API. label Dec 18, 2017
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 18, 2017
# in a separate thread.

# Sleep for however long we should be waiting.
time.sleep(self._settings.max_latency)

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


def test_publish_max_messages():
batch = create_batch(max_messages=4)
def test_publish_not_will_accept():

This comment was marked as spam.

This comment was marked as spam.

# If this message will make the batch exceed the ``max_bytes``
# setting, return False.
if self.size + message.ByteSize() > self.settings.max_bytes:
if self.size + message.ByteSize() >= self.settings.max_bytes:

This comment was marked as spam.

This comment was marked as spam.

f = futures.Future()
self._futures.append(f)
return f
return future

This comment was marked as spam.

name='Thread-CommitBatchPublisher',
target=batch._commit,
)
Thread.return_value.start.assert_called_once_with()

This comment was marked as spam.

This comment was marked as spam.

Unit tests will be coming in the next commit.

Fixes googleapis#4575.
- Changing back `>=` to `>` (I was misreading a `curr_size + EXTRA > MAX`
  as `curr_size > MAX`)
- Putting `assert_*()` calls on `Thread` mock back in the context
  manager
@dhermes dhermes merged commit 4a9a950 into googleapis:master Dec 19, 2017
@dhermes dhermes deleted the pubsub-fix-4575 branch December 19, 2017 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsub Issues related to the Pub/Sub API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants