mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
wait for redis-server to be settled and ready for connections
This commit is contained in:
parent
1488645e15
commit
4786851152
@ -22,9 +22,9 @@ proc kill_server config {
|
||||
# kill server and wait for the process to be totally exited
|
||||
exec kill $pid
|
||||
while 1 {
|
||||
# with a non-zero exit status, the process is gone
|
||||
if {[catch {exec ps -p $pid | grep redis-server} result]} {
|
||||
# non-zero exis status, process is gone
|
||||
break;
|
||||
break
|
||||
}
|
||||
after 10
|
||||
}
|
||||
@ -79,6 +79,14 @@ proc start_server {filename overrides {code undefined}} {
|
||||
error_and_quit $config_file $line
|
||||
}
|
||||
|
||||
while 1 {
|
||||
# check that the server actually started and is ready for connections
|
||||
if {[exec cat $stdout | grep "ready to accept" | wc -l] > 0} {
|
||||
break
|
||||
}
|
||||
after 10
|
||||
}
|
||||
|
||||
# find out the pid
|
||||
regexp {^\[(\d+)\]} [exec head -n1 $stdout] _ pid
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user