From 298c8bda795c1869f684ca6c5908aa25cfde7fa1 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Fri, 4 Nov 2022 10:29:04 +0000 Subject: [PATCH] Improve autolaunch if a process is misconfigured --- ChangeLog | 7 +++++++ EcCommand.m | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index b5e1e43..6dfb729 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2022-11-04 Richard Frith-Macdonald + + * EcCommand.m: When a process shuts down due to a configuration error + autolaunch is deferred for 5 minutes because human intervention is + unlikely to be rapid (thereiis no point repeatedly trying to autolaunch + a misconfigured process). + 2022-11-01 Richard Frith-Macdonald * EcAlarmDestination.h: diff --git a/EcCommand.m b/EcCommand.m index e43c9ef..c1ae461 100644 --- a/EcCommand.m +++ b/EcCommand.m @@ -2287,6 +2287,17 @@ valgrindLog(NSString *name) self, [NSThread callStackSymbols]); } [self resetDelay]; + if (terminationStatusKnown) + { + if (-3 == terminationStatus) // configuration error + { + /* Defer the actual launch for 5 minutes since a config error + * requires human intervention and is unlikely to be fixed + * very quickly. + */ + deferredDate = [NSDate timeIntervalSinceReferenceDate] + 300.0; + } + } startingAlarm = NO; startingDate = [NSDate timeIntervalSinceReferenceDate]; startingTimer = [NSTimer @@ -4362,12 +4373,20 @@ NSLog(@"Problem %@", localException); if (NO == all || [u count] > 0) { + NSString *r; + if ([u count] > 0) { [s appendFormat: @" %-32.32s is queued waiting for %@\n", [key UTF8String], u]; } + else if (nil != (r = [l reasonToPreventLaunch])) + { + [s appendFormat: + @" %-32.32s queued: %@\n", + [key UTF8String], r]; + } else { [s appendFormat: