Fix #362: prevent blocking main loop when starting run tasks

Drop complete() logic, waiting for run tasks to finish, from the
service_start() funciton to the general service_monitor().  This
refactor frees up the main loop and allows us to answer any API
calls from initctl even from the run task itself.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-09-10 13:16:09 +02:00
parent e6da0a22e7
commit 4701edef4c
3 changed files with 31 additions and 30 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ assert_restarts()
assert_restart_cnt()
{
assert "Finit restart cnt $1" "$(texec initctl status "$2" | awk '/Restarts/{print $4;}')" = "($1)"
assert "Finit restart total $1 cnt $2" "$(texec initctl status "$3" | awk '/Restarts/{print $3 $4;}')" = "$1($2)"
}
assert_norestart()
+1 -7
View File
@@ -22,12 +22,6 @@ test_teardown()
run "rm -f $FINIT_CONF"
}
check_restarts()
{
assert "serv restarts" "$(texec cat "$1" | awk '{print $1;}')" -ge "$2"
}
# shellcheck source=/dev/null
. "$TEST_DIR/lib/setup.sh"
@@ -43,7 +37,7 @@ test_one()
run "initctl reload"
# run "initctl status fail.sh"
assert_restart_cnt "$num/10" fail.sh
assert_restart_cnt "$num" "0/10" fail.sh
}
sep