Repository navigation
fix(git): git: variables resolve while the event loop is busy - #88
Merged
Merged
Conversation
The 1 s execFile timeout also counted time the loop spent on other work
before reading git's exit, so a large config on a loaded machine got
undefined for ${git:url} though git answered in ms. Bound each git read
at 30 s instead.
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
${git:url}(and every othergit:variable) comes backundefined→Missing Value ${git:url}when a large config renders on a loaded machine, even though git answers in ~6 ms.The resolver runs git through
execFilewith a 1000 mstimeout. That timer starts when git is spawned and also counts time the event loop spends resolving other variables before it reads git's exit. Once that busy time passes 1 s, the timers phase fires the timeout first and_safeGitswallows the error asundefined.Repro (saaslayer monorepo, user-service
stack.yml, ~237 variables, load ~240 on 12 cores): stack-render tests andosls packagefail on${git:url}and pass when run alone.Same resolver, loop kept busy after spawn:
https://github.com/DavidWells/saaslayerundefinedFix
One
GIT_TIMEOUT_MS = 30000used by all three git exec sites insrc/resolvers/valueFromGit.js. The timeout's job is only to stop a hung git, so it can be generous.Tests
tests/gitVariables/gitBusyLoop.test.js: resolves${git:url}and${git:commit}while the loop is busy 1.5 s, run from the check phase so the timers phase comes next (as between resolutions of a big config). 0/2 before the fix, 2/2 after (3 runs each).npm testinpackages/configorama: 2712/2712 passed (5 pre-existing skips), exit 0.