-
Notifications
You must be signed in to change notification settings - Fork 233
Open
Labels
api: pubsubIssues related to the googleapis/nodejs-pubsub API.Issues related to the googleapis/nodejs-pubsub API.
Description
Please make sure you have searched for information in the following guides.
- Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
- Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
- Check our Troubleshooting guide: https://github.com/googleapis/google-cloud-node/blob/main/docs/troubleshooting.md
- Check our FAQ: https://github.com/googleapis/google-cloud-node/blob/main/docs/faq.md
- Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
- Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
- Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples
A screenshot that you have tested with "Try this API".
Not available, this bug is part of the client shutdown behavior and not part of the pubsub API.
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
- Create a new subscription with
closeOptions: {
behavior: SubscriptionCloseBehaviors.WaitForProcessing,
timeout: Duration.from({seconds: 10}),
},- Let the message processing callback of that subscription perform work that takes a couple of seconds to finalize. Does not need to exceed the
closeOptiontimeout. - Publish messages to the topic that this subscription is bound to.
- Call
await subscription.close()during message processing - You will see that the promise is returned immediately and the
WaitForProcessingcloseOption was never entered
A clear and concise description of what the bug is, and what you expected to happen.
There seems to be a bug in the implementation of the condition during subscription close that decides to enter the waitForProcessing behavior in
nodejs-pubsub/src/subscriber.ts
Lines 1001 to 1004 in abeeb6c
| if ( | |
| behavior === SubscriberCloseBehaviors.WaitForProcessing && | |
| !this._inventory.isEmpty | |
| ) { |
this._inventory.isEmpty seems to be undefined and would need to be changed to this._inventory.isEmpty() as also suggested in the comment of the PR originally introducing this functionality: #2068 (review)
It seems that with this bug, the waitForProcessing graceful shutdown feature introduced with #2068 is not working as expected and the shutdown behavior is never initiated.
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
The WaitForProcessing closeOption was recently introduced in version 5.2.0 with #2068. In the supplied tests, the isEmpty field check is set on test level, hence letting the tests pass. However, in the source code of
Metadata
Metadata
Assignees
Labels
api: pubsubIssues related to the googleapis/nodejs-pubsub API.Issues related to the googleapis/nodejs-pubsub API.