Skip to content

Conversation

@lukesneeringer
Copy link
Contributor

Fixes #3154

@lukesneeringer lukesneeringer self-assigned this Mar 16, 2017
@lukesneeringer lukesneeringer requested a review from dhermes March 16, 2017 18:08
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 16, 2017
self.assertEqual(list(batch.messages), [MESSAGE1, MESSAGE2])
self.assertEqual(getattr(api, '_topic_published', self), self)

def test_batch_messages(self):

This comment was marked as spam.

@dhermes dhermes changed the title Add a max_size argument to Batch. Add a max_size argument to Pub / Sub Batch. Mar 16, 2017

def __init__(self, topic, client, max_interval=_INFINITY,
max_messages=_INFINITY):
max_messages=_INFINITY, max_size=10e6):

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

if isinstance(message, six.text_type):
encoded += base64.b64encode(message.encode('utf8'))
else:
encoded += base64.b64encode(message)

This comment was marked as spam.

else:
encoded += base64.b64encode(message)
encoded += base64.b64encode(
json.dumps(attrs, ensure_ascii=False).encode('utf8'),

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

self.message_ids.extend(message_ids)
del self.messages[:]
self._start_timestamp = time.time()
self._current_size = 0

This comment was marked as spam.

@lukesneeringer
Copy link
Contributor Author

lukesneeringer commented Mar 20, 2017

Approved by @dhermes in chat, confirmed by OP in #3154 to work.

@lukesneeringer lukesneeringer merged commit 6cca1ec into googleapis:master Mar 20, 2017
@lukesneeringer lukesneeringer deleted the pubsub-issue-3154 branch March 20, 2017 15:43
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
@tseaver tseaver mentioned this pull request Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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