Skip to content

pubsub: add ability to pass timeout to publish #2232

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

Merged
merged 7 commits into from
Apr 20, 2017

Conversation

dennismartensson
Copy link
Contributor

@dennismartensson dennismartensson commented Apr 18, 2017

Fixes #2230

Is based on #2042 to bring the ability to pass timeout to publish aswel.

Please have a look!

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@googlebot googlebot added the cla: no This human has *not* signed the Contributor License Agreement. label Apr 18, 2017
Copy link
Contributor

@stephenplusplus stephenplusplus left a comment

Choose a reason for hiding this comment

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

Thank you so much for helping! Would you be able to add a test kind of like this one: https://github.com/GoogleCloudPlatform/google-cloud-node/pull/2042/files#diff-cc85884063a47cfc56746a81b8b768d5R414?

@@ -456,6 +456,10 @@ Topic.prototype.publish = function(messages, options, callback) {
method: 'publish',
};

if (options && is.number(options.timeout)) {

This comment was marked as spam.

@dennismartensson
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Apr 18, 2017
@dennismartensson
Copy link
Contributor Author

@stephenplusplus I added a test like the one ju linked to.

@@ -11,3 +11,6 @@ Anand Suresh
Brett Bergmann
Jesse Friedman
Zach Bjornson <[email protected]>

Greta.io
Dennis Mårtensson <[email protected]>

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@stephenplusplus
Copy link
Contributor

Looks awesome to me, thank you very much!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c46ca54 on gretaio:pubsub-publish-timeout into 55d4d5f on GoogleCloudPlatform:master.

@dennismartensson
Copy link
Contributor Author

@stephenplusplus How long before you think could be out so we can start mitigating the timeouts?

@stephenplusplus
Copy link
Contributor

@dennismartensson I can merge and release as soon as @lukesneeringer can confirm the edit to the AUHTORS file is okay.

@dennismartensson
Copy link
Contributor Author

@stephenplusplus Thank you!

@dennismartensson
Copy link
Contributor Author

@stephenplusplus do you know what the default timeout value is?

@@ -456,6 +456,10 @@ Topic.prototype.publish = function(messages, options, callback) {
method: 'publish',
};

if (is.number(options.timeout)) {
protoOpts.timeout = options.timeout;

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@stephenplusplus
Copy link
Contributor

stephenplusplus commented Apr 18, 2017

do you know what the default timeout value is?

I'm not sure, this would be a default value that grpc sets.

Also, have you tested that this change solves the problem in #2230?

@dennismartensson
Copy link
Contributor Author

Okey, I have not tested for #2231 don't get how that is related? (might be a miss type) but looks like it can be used to solve #2230 throwing to early timeouts.

@stephenplusplus
Copy link
Contributor

Yes, it was a mis-type, sorry about that. I'm wondering if we should also default the timeout to a reasonable value, so users don't have to think about it.

@dennismartensson
Copy link
Contributor Author

That might be a good idea but what should the default value be?

@stephenplusplus
Copy link
Contributor

I'm not sure, what have you had luck with?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 98d24aa on gretaio:pubsub-publish-timeout into 55d4d5f on GoogleCloudPlatform:master.

@dennismartensson
Copy link
Contributor Author

I have only tried the default and 10 min just to make sure it went away.

@dennismartensson
Copy link
Contributor Author

dennismartensson commented Apr 18, 2017

Found this:

// The default timeout in seconds for RPCs sent to this method. This can
      // be overridden in code. If no reply is received in the specified amount
      // of time, the request is aborted and a deadline-exceeded error status
      // is returned to the caller.
      //
      // The actual deadline used will be the minimum of the value specified
      // here and the value set by the application via the gRPC client API.
      // If either one is not set, then the other will be used.
      // If neither is set, then the request has no deadline.

Here

So I guess that means it could be set by the Google cloud pub/sub endpoint? With creates that error and maybe then default today is to follow the server?

@stephenplusplus
Copy link
Contributor

Interesting. I think we should still override it. I can try to play with it later, but if you beat me to it, we want the lowest value that is consistently working. I would start at 10ms, go to 100ms, 1000ms, etc.

@dennismartensson
Copy link
Contributor Author

I think it depends a bit on many messages are posted in one go. We we where posting just one message every time the feeling is we did not have as many of this error as we do now. So should we tune it for one message or many?

My quick tests points to 225 messages around 500byte per message 10sec looks okey, If I do 450 message per publish we seam to need a higher time. But do not feel like a well thought out strategy.

Have you had the time to run any tests?

@stephenplusplus stephenplusplus merged commit 19ab795 into googleapis:master Apr 20, 2017
@stephenplusplus
Copy link
Contributor

This is good for now! I forgot we have a bit of a cheat sheet: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/master/packages/pubsub/src/v1/publisher_client_config.json

I'll go through and see that we're setting these across the API in a follow-on PR. I'll release today so you can start using (at least) the change from this PR. Thank you again for doing this!

@dennismartensson
Copy link
Contributor Author

Thank you @stephenplusplus for helping getting this out. The #2242 looks interesting!

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.

5 participants