From: Timo Sirainen Date: Tue, 30 May 2023 10:36:47 +0000 (+0300) Subject: doveadm stop: Try to wait shorter time between master process checks X-Git-Tag: 2.4.0~2716 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbc8adc6611a3919bc533154f2c93096db8abdc5;p=thirdparty%2Fdovecot%2Fcore.git doveadm stop: Try to wait shorter time between master process checks Start from 1 ms timeout, but double it until 256 ms. --- diff --git a/src/doveadm/doveadm-master.c b/src/doveadm/doveadm-master.c index 1ad9fe9457..d7674979fe 100644 --- a/src/doveadm/doveadm-master.c +++ b/src/doveadm/doveadm-master.c @@ -70,14 +70,16 @@ void doveadm_master_send_signal(int signo, struct event *event) if (signo == SIGTERM) { /* wait for a while for the process to die */ - i_sleep_msecs(1); + unsigned int sleep_msecs = 1; for (i = 0; i < 30; i++) { + i_sleep_msecs(sleep_msecs); if (kill(pid, 0) < 0) { if (errno != ESRCH) e_error(event, "kill() failed: %m"); break; } - i_sleep_msecs(100); + if (sleep_msecs < 256) + sleep_msecs *= 2; } } }