mirror of
https://github.com/actions/cache.git
synced 2025-07-15 19:45:15 -06:00
Refactor restore files to have better patterns for testing
This commit is contained in:
parent
8032cbd205
commit
d77303b678
8 changed files with 137 additions and 157 deletions
|
@ -1,26 +1,3 @@
|
|||
import restoreImpl from "./restoreImpl";
|
||||
import { StateProvider } from "./stateProvider";
|
||||
import { restoreRun } from "./restoreImpl";
|
||||
|
||||
async function run(earlyExit?: boolean | undefined): Promise<void> {
|
||||
try {
|
||||
await restoreImpl(new StateProvider());
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
if (earlyExit) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// node will stay alive if any promises are not resolved,
|
||||
// which is a possibility if HTTP requests are dangling
|
||||
// due to retries or timeouts. We know that if we got here
|
||||
// that all promises that we care about have successfully
|
||||
// resolved, so simply exit with success.
|
||||
if (earlyExit) {
|
||||
process.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
run(true);
|
||||
|
||||
export default run;
|
||||
restoreRun(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue