]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Added director_user_kick_delay setting.
authorTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 17:24:25 +0000 (20:24 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 17:24:25 +0000 (20:24 +0300)
This replaces the hardcoded 2 seconds delay. This setting specifies how long
to wait for after user has been kicked from all directors before letting the
user login to the new server. This timeout should be large enough that the
user's existing processes in the old backend should be finished.

src/director/director-settings.c
src/director/director-settings.h
src/director/director.c

index 0625e6edf533cc14f006b094873a897ffd19453f..157eea14957c9bf946fbfac193dfa5e0bc95134e 100644 (file)
@@ -72,6 +72,7 @@ static const struct setting_define director_setting_defines[] = {
        DEF(SET_STR, director_mail_servers),
        DEF(SET_STR, director_username_hash),
        DEF(SET_TIME, director_user_expire),
+       DEF(SET_TIME, director_user_kick_delay),
        DEF(SET_IN_PORT, director_doveadm_port),
        DEF(SET_BOOL, director_consistent_hashing),
 
@@ -85,6 +86,7 @@ const struct director_settings director_default_settings = {
        .director_mail_servers = "",
        .director_username_hash = "%Lu",
        .director_user_expire = 60*15,
+       .director_user_kick_delay = 2,
        .director_doveadm_port = 0
 };
 
index 1cd84e7e3fffb828f35e42b9bdf6005ec3256cc7..a95e07c6faf2bb2d08bf069e86d46323a6b5df00 100644 (file)
@@ -10,6 +10,7 @@ struct director_settings {
        const char *director_mail_servers;
        const char *director_username_hash;
        unsigned int director_user_expire;
+       unsigned int director_user_kick_delay;
        in_port_t director_doveadm_port;
        bool director_consistent_hashing;
 };
index c8d517c1dd67ee4d9a8c7f24005c77d0d0a3a16a..05460169a66341d093c498128acf4cb08462d5e7 100644 (file)
@@ -17,7 +17,6 @@
 #define DIRECTOR_RECONNECT_RETRY_SECS 60
 #define DIRECTOR_RECONNECT_TIMEOUT_MSECS (30*1000)
 #define DIRECTOR_USER_MOVE_TIMEOUT_MSECS (30*1000)
-#define DIRECTOR_USER_MOVE_FINISH_DELAY_MSECS (2*1000)
 #define DIRECTOR_SYNC_TIMEOUT_MSECS (5*1000)
 #define DIRECTOR_RING_MIN_WAIT_SECS 20
 #define DIRECTOR_QUICK_RECONNECT_TIMEOUT_MSECS 1000
@@ -667,7 +666,10 @@ director_user_kill_finish_delayed(struct director *dir, struct user *user)
        user->kill_state = USER_KILL_STATE_DELAY;
        timeout_remove(&user->to_move);
 
-       user->to_move = timeout_add(DIRECTOR_USER_MOVE_FINISH_DELAY_MSECS,
+       /* wait for a while for the kills to finish in the backend server,
+          so there are no longer any processes running for the user before we
+          start letting new in connections to the new server. */
+       user->to_move = timeout_add(dir->set->director_user_kick_delay * 1000,
                                    director_user_kill_finish_delayed_to, ctx);
 }