Skip to content
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

Moving will_accept() check out of PublisherClient.batch() factory. #4613

Merged
merged 1 commit into from
Dec 18, 2017

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