-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add a max_size argument to Pub / Sub Batch.
#3157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a max_size argument to Pub / Sub Batch.
#3157
Conversation
| 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.
This comment was marked as spam.
Sorry, something went wrong.
max_size argument to Batch.max_size argument to Pub / Sub Batch.
pubsub/google/cloud/pubsub/topic.py
Outdated
|
|
||
| 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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
pubsub/google/cloud/pubsub/topic.py
Outdated
| if isinstance(message, six.text_type): | ||
| encoded += base64.b64encode(message.encode('utf8')) | ||
| else: | ||
| encoded += base64.b64encode(message) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| self.message_ids.extend(message_ids) | ||
| del self.messages[:] | ||
| self._start_timestamp = time.time() | ||
| self._current_size = 0 |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Fixes #3154