-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3762 from github/koesie10/fix-codeql-download
Store state of CodeQL distribution on filesystem instead of in `globalState`
- Loading branch information
Showing
7 changed files
with
573 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { lock } from "proper-lockfile"; | ||
|
||
export async function withDistributionUpdateLock( | ||
lockFile: string, | ||
f: () => Promise<void>, | ||
) { | ||
const release = await lock(lockFile, { | ||
stale: 60_000, // 1 minute. We can take the lock longer than this because that's based on the update interval. | ||
update: 10_000, // 10 seconds | ||
retries: { | ||
minTimeout: 10_000, | ||
maxTimeout: 60_000, | ||
retries: 100, | ||
}, | ||
}); | ||
|
||
try { | ||
await f(); | ||
} finally { | ||
await release(); | ||
} | ||
} |
Oops, something went wrong.