From ac67be1943e3c8d5c6a5963fab7afe4875b9f16e Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Sun, 21 Sep 2003 00:37:07 +0000
Subject: [PATCH] Minor code restructuring to improve responsiveness of
 slurmctld backup server to shutdown request.

---
 src/slurmctld/backup.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/slurmctld/backup.c b/src/slurmctld/backup.c
index 6b8cf1f1ec6..883a9270d88 100644
--- a/src/slurmctld/backup.c
+++ b/src/slurmctld/backup.c
@@ -96,9 +96,10 @@ void run_backup(void)
 			&thread_attr_rpc, _background_rpc_mgr, NULL))
 		fatal("pthread_create error %m");
 
+	sleep(5);	/* Give the primary slurmctld set-up time */
 	/* repeatedly ping ControlMachine */
 	while (slurmctld_config.shutdown_time == 0) {
-		sleep(5);	/* Give the primary slurmctld set-up time */
+		sleep(1);
 		if (difftime(time(NULL), last_ping) <
 		    slurmctld_conf.heartbeat_interval)
 			continue;
@@ -111,8 +112,8 @@ void run_backup(void)
 			break;
 	}
 	if (slurmctld_config.shutdown_time != 0) {
-		pthread_join(slurmctld_config.thread_id_sig, NULL);
 		info("BackupController terminating");
+		pthread_join(slurmctld_config.thread_id_sig, NULL);
 		if (unlink(slurmctld_conf.slurmctld_pidfile) < 0)
 			error("Unable to remove pidfile '%s': %m",
 		     	 slurmctld_conf.slurmctld_pidfile);
-- 
GitLab