子进程重启失败时,不断重试,避免重启失败 (#1545)

* Update main.cpp

* 双重保险, 避免重启失败

业务繁忙的服务器当子进程崩溃后,
虽然延时了3秒, 但是如果服务器负载很高, 或者开启了coredump
会导致拉起子进程时, 仍旧端口占用导致子进程重启失败而直接退出主进程.

因此, 这里做了双重保险, 当子进程拉起时如果端口占用, 那么子进程会继续重试.
This commit is contained in:
alexliyu7352
2022-04-09 20:37:36 +08:00
committed by GitHub
parent a1b350c9f0
commit 471a8b7735
2 changed files with 13 additions and 3 deletions

View File

@@ -318,7 +318,7 @@ int start_main(int argc,char *argv[]) {
sleep(1);
#if !defined(_WIN32)
if (pid != getpid()) {
kill(pid, SIGINT);
kill(pid, SIGUSR1);
}
#endif
return -1;