-
Notifications
You must be signed in to change notification settings - Fork 337
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
Avoid unref-ing timer while awaiting status upload #1539
Conversation
This was not a user-facing bug, so no change note required. |
src/util.ts
Outdated
* @param milliseconds time to delay | ||
* @param opts.unref if true, the timer will not prevent the process from exiting | ||
*/ | ||
export async function delay(milliseconds: number, opts: { unref: boolean }) { |
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.
Idea you can take or leave: it might make our code slightly more readable to rename unref
to something like allowProcessExitDuringDelay
.
5eb309d
to
969e487
Compare
src/util.ts
Outdated
return new Promise((resolve) => setTimeout(resolve, milliseconds).unref()); | ||
/** | ||
* @param milliseconds time to delay | ||
* @param unref if true, the timer will not prevent the process from exiting |
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.
Nit: update JSDoc. The spec recommends writing down two @param
s for a destructured parameter, which seems a little verbose (https://jsdoc.app/tags-param.html#parameters-with-properties).
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.
Hmmm...that's a little verbose, but I'll go with the spec.
We had a problem where `waitForProcessing` was not completing before the node process ends. This is because using `unref` would allow the node process to end without having the `delay` function complete.
969e487
to
a2487fb
Compare
We had a problem where
waitForProcessing
was not completing before the node process ends. This is because usingunref
would allow the node process to end without having thedelay
function complete.Merge / deployment checklist