-
Notifications
You must be signed in to change notification settings - Fork 230
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
fix: deprecate maxExtension in favour of maxExtensionMinutes #1402
Conversation
Background: maxExtension was incorrectly interpreted as seconds in the LeaseManager. This means that if users were relying on client side lease extension in subscribers, they would not actually extend leases for 60 minutes, but only 60 seconds. Also if the user passed in values, they'd be interpreted incorrectly. This PR deprecates the old field in favour of a new one that's explicitly named like the defaults, but also converts the old value if needed.
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.
LGTM. Looks like the Node.js sample just uses maxMessages
. Can you think of any other places we need to update?
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.
LGTM with nit.
@@ -182,10 +185,19 @@ export class LeaseManager extends EventEmitter { | |||
* @private | |||
*/ | |||
setOptions(options: FlowControlOptions): void { | |||
// Convert the old deprecated maxExtension to avoid breaking clients. | |||
if ( | |||
options.maxExtension !== undefined && |
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.
What happens if both are defined?
I think this is maxMessages rather than maxExtension, should be unchanged. |
🤖 I have created a release \*beep\* \*boop\* --- ### [2.18.1](https://github.com/googleapis/nodejs-pubsub/compare/v2.18.0...v2.18.1) (2021-09-27) ### Bug Fixes * deprecate maxExtension in favour of maxExtensionMinutes ([#1402](https://github.com/googleapis/nodejs-pubsub/issues/1402)) ([46b83ba](https://github.com/googleapis/nodejs-pubsub/commit/46b83ba14e954cc6bec3f03ca7c3e0bcdfb7597c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Background: maxExtension was incorrectly interpreted as seconds in the LeaseManager. This means that if users were relying on client side lease extension in subscribers, they would not actually extend leases for 60 minutes, but only 60 seconds. Also if the user passed in values, they'd be interpreted incorrectly. This PR deprecates the old field in favour of a new one that's explicitly named like the defaults, but also converts the old value if needed.
Fixes: #1208