GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Change waitForProcessing to use exponential backoff by robertbrignull · Pull Request #3937 · github/codeql-action Conversation
Contributor
The goal is to change In this PR I'm suggesting changing it to exponential backoff that'll make a maximum of 5 requests, instead of the current behaviour which can make up to 24 requests. I also add a wait before the first poll because processing will always take at least a couple of seconds so it's unlikely that an immediate poll will get anything. Let me know if you think this is reasonable. We can also tweak values to keep the maximum timeout to 2 minutes if that would be better. Risk assessmentFor internal use only. Please select the risk level of this change:
Which use cases does this change impact?Workflow types:
Products:
Environments:
How did/will you validate this change?
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pull request overviewThis PR changes SARIF processing polling to use exponential backoff, reducing request volume during delayed analysis processing. Changes:
Show a summary per file
Copilot's findings
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Comment on lines
+922
to
+923
|
| for ( | ||
| let statusCheckingCount = 0; | ||
| statusCheckingCount <= STATUS_CHECK_MAX_TRIES; // Aborts on the last loop iteration | ||
| statusCheckingCount++ | ||
| ) { | ||
| if (statusCheckingCount === STATUS_CHECK_MAX_TRIES) { |
e930918 to
dfc1411
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for preparing this! The change makes to me as-is and there's nothing blocking here.
We may want to review how well chosen the backoff pattern is, but that's something we can adjust later if needed.
Just one comment about the (potential) delay this imposes on the unit tests.
Also agree with Copilot that it would be nice to have a test that checks that this works as expected.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| let statusCheckBackoff = STATUS_CHECK_INITIAL_BACKOFF_MILLISECONDS; | ||
| await util.delay(statusCheckBackoff, { allowProcessExit: false }); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Minor: I think this also adds a STATUS_CHECK_INITIAL_BACKOFF_MILLISECONDS long delay to tests where we can get a "response" from a stubbed client.request faster. If that is the case, we could either make this initial wait conditional on e.g. the NODE_ENV (like in #3930) or stub util.delay in relevant tests to not wait.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good point. I think skipping this initial wait during tests makes sense.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looking more closely, the code from #3930 has now changed and there aren't any other references to NODE_ENV is the codebase. I've changed this PR to use isInTestMode(). Do you think that's the right way to do things?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I don't have any good data on what a good backoff pattern would be. This was just the idea that came to me first. But yes, it's easy to adjust it later on. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Echoing Michael's review, this looks good. One comment: I think it would be better to use NODE_ENV as you originally implemented vs isInTestMode — the latter is mainly intended for disabling uploading SARIFs to code scanning, and I don't think it's true when we run the unit tests locally or in CI. We can add NODE_ENV to queries/default-setup-environment-variables.ql to suppress the warning, sorry about the noise from that check.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
b37e12b to
d40e417
Compare
Thanks for explaining. I'll just remove my last commit. I looked earlier for the test mode env var and saw lots of cases of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I also tested this with an advanced setup workflow in a test repo and everything worked as expected. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.