From 7a929c50adbefa41aaef2a2888d85525ef1de51c Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Fri, 19 May 2006 00:14:46 +0000
Subject: [PATCH] Try to process pending agent requests before shutdown.

---
 src/slurmctld/controller.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c
index 866f7efba0c..f873c76992c 100644
--- a/src/slurmctld/controller.c
+++ b/src/slurmctld/controller.c
@@ -706,7 +706,7 @@ static void *_slurmctld_background(void *no_data)
 	static time_t last_timelimit_time;
 	static time_t last_assert_primary_time;
 	time_t now;
-	int ping_interval;
+	int i, ping_interval;
 	DEF_TIMERS;
 
 	/* Locks: Read config */
@@ -842,6 +842,14 @@ static void *_slurmctld_background(void *no_data)
 		if (DELTA_TIMER > 1000000)	/* more than one second */ 
 			info("_slurmctld_background loop %s", TIME_STR);
 	}
+
+	for (i=0; i<20; i++) {
+		if (agent_retry(0) == 0)
+			break;
+		usleep(1000);
+	}
+	if (agent_retry(0))
+		error("terminating with %d pending message agent requests", cnt);
 	debug3("_slurmctld_background shutting down");
 
 	return NULL;
-- 
GitLab