From 1332916a6a9a3a54834387c56b8e399711aeb8d1 Mon Sep 17 00:00:00 2001 From: mar Date: Mon, 21 Aug 1989 21:54:17 +0000 Subject: [PATCH] wait a minute after deadlock before trying again to update state in DB --- dcm/dcm.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dcm/dcm.c b/dcm/dcm.c index bfb5cfab..1863a204 100644 --- a/dcm/dcm.c +++ b/dcm/dcm.c @@ -34,6 +34,9 @@ int gqval(); long time(); +#define DEADLOCK_WAIT (3 * 60) /* number of seconds to wait after + a deadlock before trying again. */ + /* declared global so that we can get the current time from different places. */ struct timeval tv; @@ -253,7 +256,8 @@ do_services() scream, NULL); if (status) { com_err(whoami, status, - " setting service state, trying again"); + " setting service state, sleeping"); + sleep(DEADLOCK_WAIT); status = sms_query("set_server_internal_flags", 6, qargv, scream, NULL); if (status) @@ -411,7 +415,8 @@ struct service *svc; 6, qargv, scream, NULL); if (status) { com_err(whoami, status, - " setting service state, trying again"); + " setting service state, sleeping"); + sleep(DEADLOCK_WAIT); status = sms_query("set_server_internal_flags", 6, qargv, scream, NULL); if (status) @@ -431,7 +436,8 @@ struct service *svc; 9, argv,scream,NULL); if (status) { com_err(whoami, status, - " setting host state, trying again"); + " setting host state, sleeping"); + sleep(DEADLOCK_WAIT); status = sms_query("set_server_host_internal", 9, argv,scream,NULL); if (status) @@ -446,7 +452,8 @@ struct service *svc; close(lock_fd); status = sms_query("set_server_host_internal", 9, argv,scream,NULL); if (status) { - com_err(whoami, status, " setting host state, trying again"); + com_err(whoami, status, " setting host state, sleeping"); + sleep(DEADLOCK_WAIT); status = sms_query("set_server_host_internal", 9, argv,scream,NULL); if (status) com_err(whoami, status, " setting host state again"); -- 2.45.2