1
0
Fork 0
mirror of https://github.com/cachix/cachix-action.git synced 2025-06-08 07:07:00 +09:00

Add a small delay to allow all the post-build hooks to flush

This commit is contained in:
Sander 2024-11-15 18:08:35 +04:00
parent aa9851471c
commit 5581d69e7f
No known key found for this signature in database
GPG key ID: D1A763BC84F34603
2 changed files with 14 additions and 2 deletions

7
dist/main/index.js vendored
View file

@ -7920,13 +7920,15 @@ async function upload() {
core.debug(`Found Cachix daemon with pid ${daemonPid}`);
let daemonLog = new tail_1.Tail(`${daemonDir}/daemon.log`, { fromBeginning: true });
daemonLog.on('line', (line) => core.info(line));
// Give the Nix daemon time to send out the post-build hooks
await sleep(300);
try {
core.debug('Waiting for Cachix daemon to exit...');
await exec.exec(cachixBin, ["daemon", "stop", "--socket", `${daemonDir}/daemon.sock`]);
}
finally {
// Wait a bit for the logs to flush through
await new Promise((resolve) => setTimeout(resolve, 1000));
await sleep(1000);
daemonLog.unwatch();
}
break;
@ -8089,6 +8091,9 @@ function partitionUsersAndGroups(mixedUsers) {
function splitArgs(args) {
return args.split(' ').filter((arg) => arg !== '');
}
async function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
const isPost = !!core.getState('isPost');
// Main
try {

View file

@ -234,12 +234,15 @@ async function upload() {
let daemonLog = new Tail(`${daemonDir}/daemon.log`, { fromBeginning: true });
daemonLog.on('line', (line) => core.info(line));
// Give the Nix daemon time to send out the post-build hooks
await sleep(300);
try {
core.debug('Waiting for Cachix daemon to exit...');
await exec.exec(cachixBin, ["daemon", "stop", "--socket", `${daemonDir}/daemon.sock`]);
} finally {
// Wait a bit for the logs to flush through
await new Promise((resolve) => setTimeout(resolve, 1000));
await sleep(1000);
daemonLog.unwatch();
}
@ -433,6 +436,10 @@ function splitArgs(args: string): string[] {
return args.split(' ').filter((arg) => arg !== '');
}
async function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
const isPost = !!core.getState('isPost');
// Main