]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Notify master immediately when process can accept more clients
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 16 Jan 2020 12:58:21 +0000 (14:58 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 14 Jan 2021 11:16:54 +0000 (11:16 +0000)
Instead of delaying it for 1 second. Otherwise the master might be
complaining about process/client limit being reached or creating more
processes unnecessarily.

src/lib-master/master-service.c

index 1dfcde0ef27ff4e6fdda6ebce15b26841f7533d4..f86aaa2667a49952ac8664a5a8c3cc6630e7491e 100644 (file)
@@ -1268,10 +1268,20 @@ static void master_service_io_listeners_close(struct master_service *service)
 
 static bool master_status_update_is_important(struct master_service *service)
 {
-       if (service->master_status.available_count == 0)
+       if (service->master_status.available_count == 0) {
+               /* client_limit reached for this process */
                return TRUE;
-       if (!service->initial_status_sent)
+       }
+       if (service->last_sent_status_avail_count == 0) {
+               /* This process can now handle more clients. This is important
+                  to know for master if all the existing processes have
+                  avail_count=0 so it doesn't unnecessarily create more
+                  processes. */
                return TRUE;
+       }
+       /* The previous check should have triggered also for the initial
+          status notification. */
+       i_assert(service->initial_status_sent);
        return FALSE;
 }