Skip to content

Conversation

@dhermes
Copy link
Contributor

@dhermes dhermes commented Dec 18, 2017

This is the first stage of moving that check directly into Batch.publish(). This check must occur when the message is being published because concurrent access to the messages and futures on a Batch make it impossible to reliably do an LBYL "will accept?" check.

Towards #4575.

This is the first stage of moving that check directly into
`Batch.publish()`. This check **must** occur when the message
is being published because concurrent access to the messages
and futures on a `Batch` make it impossible to reliably do
an LBYL "will accept?" check.
@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
if batch.will_accept(message):
future = batch.publish(message)
else:
batch = self.batch(topic, create=True)

This comment was marked as spam.

if not create:
batch = self._batches.get(topic)
if batch is None:
create = True

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Copy link
Contributor

@lukesneeringer lukesneeringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with @dhermes at length in Hangouts; this is approved.

@dhermes dhermes merged commit 72cbe41 into googleapis:master Dec 18, 2017
@dhermes dhermes deleted the pubsub-publisher-batch-refactor branch December 18, 2017 21:03
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