FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Avoid unref-ing timer while awaiting status upload by aeisenberg · Pull Request #1539 · github/codeql-action · GitHub

Avoid unref-ing timer while awaiting status upload - #1539

Merged
aeisenberg merged 1 commit into
mainfrom
aeisenberg/unref-delay
Feb 13, 2023
Merged

aeisenberg merged 1 commit into
mainfrom
aeisenberg/unref-delay

Conversation

aeisenberg commented Feb 13, 2023
edited
Loading

Copy link
Copy Markdown
Contributor

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.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

aeisenberg requested a review from a team as a code owner February 13, 2023 21:26

Copy link
Copy Markdown
Contributor Author

This was not a user-facing bug, so no change note required.

henrymercer previously approved these changes Feb 13, 2023
Comment thread 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 }) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Idea you can take or leave: it might make our code slightly more readable to rename unref to something like allowProcessExitDuringDelay.

henrymercer previously approved these changes Feb 13, 2023
Comment thread 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nit: update JSDoc. The spec recommends writing down two @params for a destructured parameter, which seems a little verbose (https://jsdoc.app/tags-param.html#parameters-with-properties).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.
aeisenberg merged commit e00cd12 into main Feb 13, 2023
aeisenberg deleted the aeisenberg/unref-delay branch February 13, 2023 23:24
github-actions Bot mentioned this pull request Feb 24, 2023
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL