From f973ecf2818ba56362d5e1fa618703a8adc2209e Mon Sep 17 00:00:00 2001 From: Brikaa Date: Sun, 10 Oct 2021 17:18:31 +0200 Subject: [PATCH 1/2] Add infinite timeout --- api/src/job.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index c2e8bc8..3ad77c7 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -143,12 +143,15 @@ class Job { }); } - const kill_timeout = set_timeout(async _ => { - logger.info( - `Timeout exceeded timeout=${timeout} uuid=${this.uuid}` - ); - process.kill(proc.pid, 'SIGKILL'); - }, timeout); + const kill_timeout = + (timeout >= 0 && + set_timeout(async _ => { + logger.info( + `Timeout exceeded timeout=${timeout} uuid=${this.uuid}` + ); + process.kill(proc.pid, 'SIGKILL'); + }, timeout)) || + null; proc.stderr.on('data', async data => { if (eventBus !== null) { From 5968090f502cead8a6368bf8182f07186be03b35 Mon Sep 17 00:00:00 2001 From: Brikaa Date: Sun, 10 Oct 2021 16:56:16 +0200 Subject: [PATCH 2/2] Improve precommit --- piston | 15 ++++++++++++--- pre-commit | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/piston b/piston index 90d47ed..068895b 100755 --- a/piston +++ b/piston @@ -11,6 +11,13 @@ docker_compose(){ fi } +init_precommit() { + if [ $PISTON_ENV == "dev" ]; then + rm -f .git/hooks/pre-commit + ln -s $(realpath $(dirname "$0"))/pre-commit .git/hooks/pre-commit + fi +} + case $1 in help) echo "=== Piston Management ===" @@ -55,14 +62,16 @@ case $1 in restart) docker_compose restart ;; start) - rm -f .git/hooks/pre-commit - ln -s $(realpath $(dirname "$0"))/pre-commit .git/hooks/pre-commit + init_precommit docker_compose up -d ;; stop) docker_compose down ;; bash) docker_compose exec api /bin/bash ;; - rebuild) docker_compose build && docker_compose up -d ;; + rebuild) + init_precommit + docker_compose build && docker_compose up -d + ;; update) git pull diff --git a/pre-commit b/pre-commit index f592c88..288a5e3 100755 --- a/pre-commit +++ b/pre-commit @@ -1,7 +1,7 @@ #!/bin/sh echo "Linting staged files..." -npm install +npm install > /dev/null || exit 1 FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') [ -z "$FILES" ] && exit 0