-
Notifications
You must be signed in to change notification settings - Fork 616
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
pubsub: add ability to pass timeout to publish #2232
Conversation
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.
|
There was a problem hiding this 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?
packages/pubsub/src/topic.js
Outdated
@@ -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.
This comment was marked as spam.
Sorry, something went wrong.
I signed it! |
CLAs look good, thanks! |
@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.
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.
Looks awesome to me, thank you very much! |
@stephenplusplus How long before you think could be out so we can start mitigating the timeouts? |
@dennismartensson I can merge and release as soon as @lukesneeringer can confirm the edit to the AUHTORS file is okay. |
@stephenplusplus Thank you! |
@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.
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.
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. |
That might be a good idea but what should the default value be? |
I'm not sure, what have you had luck with? |
I have only tried the default and 10 min just to make sure it went away. |
Found this:
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? |
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. |
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? |
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! |
Thank you @stephenplusplus for helping getting this out. The #2242 looks interesting! |
Fixes #2230
Is based on #2042 to bring the ability to pass timeout to publish aswel.
Please have a look!