b3fe293
diff --git a/src/condor_c-gahp/schedd_client.cpp b/src/condor_c-gahp/schedd_client.cpp
b3fe293
index e3acc44..ba96490 100644
b3fe293
--- a/src/condor_c-gahp/schedd_client.cpp
b3fe293
+++ b/src/condor_c-gahp/schedd_client.cpp
b3fe293
@@ -173,7 +173,10 @@ doContactSchedd()
b3fe293
 		}
b3fe293
 	}
b3fe293
 
b3fe293
-	
b3fe293
+	int interaction_time = param_integer("CGAHP_SCHEDD_INTERACTION_TIME", 5);
b3fe293
+	time_t starttime = time(NULL);
b3fe293
+	bool rerun_immediately = false;
b3fe293
+
b3fe293
 	SchedDRequest::schedd_command_type commands [] = {
b3fe293
 		SchedDRequest::SDC_REMOVE_JOB,
b3fe293
 		SchedDRequest::SDC_HOLD_JOB,
b3fe293
@@ -188,7 +191,11 @@ doContactSchedd()
b3fe293
 	int i=0;
b3fe293
 	while (i<3) {
b3fe293
 		
b3fe293
-		
b3fe293
+		if (time(NULL) - starttime > interaction_time) {
b3fe293
+			rerun_immediately = true;
b3fe293
+			break;
b3fe293
+		}
b3fe293
+
b3fe293
 		StringList id_list;
b3fe293
 		SimpleList <SchedDRequest*> this_batch;
b3fe293
 
b3fe293
@@ -361,6 +368,12 @@ doContactSchedd()
b3fe293
 
b3fe293
 	SimpleList <SchedDRequest*> stage_in_batch;
b3fe293
 	do {
b3fe293
+
b3fe293
+		if (time(NULL) - starttime > interaction_time) {
b3fe293
+			rerun_immediately = true;
b3fe293
+			break;
b3fe293
+		}
b3fe293
+
b3fe293
 		stage_in_batch.Clear();
b3fe293
 
b3fe293
 		command_queue.Rewind();
b3fe293
@@ -507,6 +520,11 @@ doContactSchedd()
b3fe293
 		if (current_command->command != SchedDRequest::SDC_JOB_REFRESH_PROXY)
b3fe293
 			continue;
b3fe293
 
b3fe293
+		if (time(NULL) - starttime > interaction_time) {
b3fe293
+			rerun_immediately = true;
b3fe293
+			break;
b3fe293
+		}
b3fe293
+
b3fe293
 		time_t expiration_time = GetDesiredDelegatedJobCredentialExpiration(current_command->classad);
b3fe293
 		time_t result_expiration_time = 0;
b3fe293
 
b3fe293
@@ -591,7 +609,12 @@ doContactSchedd()
b3fe293
 
b3fe293
 		if (qmgr_connection == NULL)
b3fe293
 			goto update_report_result;
b3fe293
-		
b3fe293
+
b3fe293
+		if (time(NULL) - starttime > interaction_time) {
b3fe293
+			rerun_immediately = true;
b3fe293
+			break;
b3fe293
+		}
b3fe293
+
b3fe293
 		error = FALSE;
b3fe293
 		errno = 0;
b3fe293
 		BeginTransaction();
b3fe293
@@ -631,7 +654,8 @@ doContactSchedd()
b3fe293
 					if( SetAttribute(current_command->cluster_id,
b3fe293
 											current_command->proc_id,
b3fe293
 											lhstr,
b3fe293
-											rhstr) == -1 ) {
b3fe293
+											rhstr,
b3fe293
+											SetAttribute_NoAck) == -1 ) {
b3fe293
 						if ( errno == ETIMEDOUT ) {
b3fe293
 							failure_line_num = __LINE__;
b3fe293
 							failure_errno = errno;
b3fe293
@@ -698,6 +722,11 @@ update_report_result:
b3fe293
 		if (current_command->command != SchedDRequest::SDC_UPDATE_LEASE)
b3fe293
 			continue;
b3fe293
 
b3fe293
+		if (time(NULL) - starttime > interaction_time) {
b3fe293
+			rerun_immediately = true;
b3fe293
+			break;
b3fe293
+		}
b3fe293
+
b3fe293
 		std::string success_job_ids="";
b3fe293
 		if (qmgr_connection == NULL) {
b3fe293
 			sprintf( error_msg, "Error connecting to schedd %s", ScheddAddr );
b3fe293
@@ -803,6 +832,11 @@ update_report_result:
b3fe293
 		if (current_command->command != SchedDRequest::SDC_SUBMIT_JOB)
b3fe293
 			continue;
b3fe293
 
b3fe293
+		if (time(NULL) - starttime > interaction_time) {
b3fe293
+			rerun_immediately = true;
b3fe293
+			break;
b3fe293
+		}
b3fe293
+
b3fe293
 		int ClusterId = -1;
b3fe293
 		int ProcId = -1;
b3fe293
 
b3fe293
@@ -929,7 +963,8 @@ update_report_result:
b3fe293
 					error = TRUE;
b3fe293
 				} else if( SetAttribute (ClusterId, ProcId,
b3fe293
 											lhstr,
b3fe293
-											rhstr) == -1 ) {
b3fe293
+											rhstr,
b3fe293
+											SetAttribute_NoAck) == -1 ) {
b3fe293
 					if ( errno == ETIMEDOUT ) {
b3fe293
 						failure_line_num = __LINE__;
b3fe293
 						failure_errno = errno;
b3fe293
@@ -993,6 +1028,11 @@ submit_report_result:
b3fe293
 		if (current_command->command != SchedDRequest::SDC_STATUS_CONSTRAINED)
b3fe293
 			continue;
b3fe293
 
b3fe293
+		if (time(NULL) - starttime > interaction_time) {
b3fe293
+			rerun_immediately = true;
b3fe293
+			break;
b3fe293
+		}
b3fe293
+
b3fe293
 		if (qmgr_connection != NULL) {
b3fe293
 			SimpleList <MyString *> matching_ads;
b3fe293
 
b3fe293
@@ -1165,9 +1205,14 @@ submit_report_result:
b3fe293
 		}
b3fe293
 	}
b3fe293
 
b3fe293
+	dprintf (D_FULLDEBUG, "Schedd interaction took %ld seconds.\n", time(NULL)-starttime);
b3fe293
+	if (rerun_immediately) {
b3fe293
+		dprintf (D_FULLDEBUG, "Schedd interaction time hit limit; will retry immediately.\n");
b3fe293
+	}
b3fe293
+
b3fe293
 	// Come back soon..
b3fe293
 	// QUESTION: Should this always be a fixed time period?
b3fe293
-	daemonCore->Reset_Timer( contactScheddTid, contact_schedd_interval );
b3fe293
+	daemonCore->Reset_Timer( contactScheddTid, rerun_immediately ? 1 : contact_schedd_interval );
b3fe293
 }
b3fe293
 
b3fe293