Merge pull request #49 from DeterminateSystems/late-start

Don't mark the daemon started until after we successfully import the …
This commit is contained in:
Graham Christensen 2024-05-08 11:34:32 -04:00 committed by GitHub
commit 88b25d24b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

4
dist/index.js generated vendored
View file

@ -94819,8 +94819,6 @@ var MagicNixCacheAction = class {
core.debug( core.debug(
`GitHub Action Cache URL: ${process.env["ACTIONS_CACHE_URL"]}` `GitHub Action Cache URL: ${process.env["ACTIONS_CACHE_URL"]}`
); );
this.daemonStarted = true;
core.saveState(STATE_STARTED, STARTED_HINT);
const sourceBinary = inputs_exports.getStringOrNull("source-binary"); const sourceBinary = inputs_exports.getStringOrNull("source-binary");
const daemonBin = sourceBinary !== null ? sourceBinary : await this.fetchAutoCacher(); const daemonBin = sourceBinary !== null ? sourceBinary : await this.fetchAutoCacher();
let runEnv; let runEnv;
@ -94897,6 +94895,8 @@ var MagicNixCacheAction = class {
core.debug("Full daemon start command:"); core.debug("Full daemon start command:");
core.debug(`${daemonBin} ${daemonCliFlags.join(" ")}`); core.debug(`${daemonBin} ${daemonCliFlags.join(" ")}`);
const daemon = (0,external_node_child_process_namespaceObject.spawn)(daemonBin, daemonCliFlags, opts); const daemon = (0,external_node_child_process_namespaceObject.spawn)(daemonBin, daemonCliFlags, opts);
this.daemonStarted = true;
core.saveState(STATE_STARTED, STARTED_HINT);
const pidFile = external_node_path_namespaceObject.join(this.daemonDir, "daemon.pid"); const pidFile = external_node_path_namespaceObject.join(this.daemonDir, "daemon.pid");
await promises_namespaceObject.writeFile(pidFile, `${daemon.pid}`); await promises_namespaceObject.writeFile(pidFile, `${daemon.pid}`);
core.info("Waiting for magic-nix-cache to start..."); core.info("Waiting for magic-nix-cache to start...");

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -109,8 +109,6 @@ class MagicNixCacheAction {
`GitHub Action Cache URL: ${process.env["ACTIONS_CACHE_URL"]}`, `GitHub Action Cache URL: ${process.env["ACTIONS_CACHE_URL"]}`,
); );
this.daemonStarted = true;
actionsCore.saveState(STATE_STARTED, STARTED_HINT);
const sourceBinary = inputs.getStringOrNull("source-binary"); const sourceBinary = inputs.getStringOrNull("source-binary");
const daemonBin = const daemonBin =
sourceBinary !== null ? sourceBinary : await this.fetchAutoCacher(); sourceBinary !== null ? sourceBinary : await this.fetchAutoCacher();
@ -206,6 +204,9 @@ class MagicNixCacheAction {
// Start the server. Once it is ready, it will notify us via the notification server. // Start the server. Once it is ready, it will notify us via the notification server.
const daemon = spawn(daemonBin, daemonCliFlags, opts); const daemon = spawn(daemonBin, daemonCliFlags, opts);
this.daemonStarted = true;
actionsCore.saveState(STATE_STARTED, STARTED_HINT);
const pidFile = path.join(this.daemonDir, "daemon.pid"); const pidFile = path.join(this.daemonDir, "daemon.pid");
await fs.writeFile(pidFile, `${daemon.pid}`); await fs.writeFile(pidFile, `${daemon.pid}`);