-
Notifications
You must be signed in to change notification settings - Fork 227
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
feat: add a close() method to PubSub, and a flush() method to Topic/Publisher #916
Conversation
Looks like there's an issue in checkout@v1, and we hadn't updated all of the CI actions to v2. |
6e0f492
to
54b6ab0
Compare
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.
This looks reasonable to me, not seeing any possums.
); | ||
const allPublishes = Promise.all(publishes); | ||
|
||
allPublishes |
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.
any reason not to use async
/await
here? I'm at the point where I pretty much always favor it these days.
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.
Yeah, I about 350% agree... unfortunately the current code is mostly callback-based, and a few event-based bits, so pulling the async/await far up the stack was looking difficult. I'd really like to go back and do a pass of just converting everything to straightforward async/await/Promises, but I don't want to do that as part of this.
const definedCallback = callback || (() => {}); | ||
if (this.isOpen) { | ||
this.closeAllClients_() | ||
.then(() => { |
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.
same comment, as above. I can understand the argument for keeping the codebase internally consistent, if that's the thinking.
I added a note about the potentially flaky test, re-running Kokoro for now. |
🤖 I have created a release \*beep\* \*boop\* --- ## [1.7.0](https://www.github.com/googleapis/nodejs-pubsub/compare/v1.6.0...v1.7.0) (2020-03-29) ### Features * add a close() method to PubSub, and a flush() method to Topic/Publisher ([#916](https://www.github.com/googleapis/nodejs-pubsub/issues/916)) ([4097995](https://www.github.com/googleapis/nodejs-pubsub/commit/4097995a85a8ca3fb73c2c2a8cb0649cdd4274be)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please).
…ublisher (#916) 4097995 commit 4097995 Author: Megan Potter <[email protected]> Date: Thu Mar 26 11:03:26 2020 -0700 feat: add a close() method to PubSub, and a flush() method to Topic/Publisher (#916) * docs: fix a typo in a comment * feat: allow manually closing the server connections in the PubSub object * feat: add flush() method for Topic objects * tests: add tests for new flush() and close() methods * build: update github checkout action to v2 to fix spurious retry errors * fix: set isOpen to false before trying to close it so that all usage will stop
b96eacf commit b96eacf Author: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Date: Mon Mar 30 21:46:18 2020 +0000 chore: release 1.7.0 (#933) 🤖 I have created a release \*beep\* \*boop\* --- ## [1.7.0](https://www.github.com/googleapis/nodejs-pubsub/compare/v1.6.0...v1.7.0) (2020-03-29) ### Features * add a close() method to PubSub, and a flush() method to Topic/Publisher ([#916](https://www.github.com/googleapis/nodejs-pubsub/issues/916)) ([4097995](https://www.github.com/googleapis/nodejs-pubsub/commit/4097995a85a8ca3fb73c2c2a8cb0649cdd4274be)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Fixes: #817