From b4c55decc64f7f496dcc7c3b6076f21a7752e8cd Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 30 Jan 2025 18:28:16 -0500 Subject: [PATCH] Document RunShutdownable in Run --- run.go | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/run.go b/run.go index a050587..5ef26c0 100644 --- a/run.go +++ b/run.go @@ -9,7 +9,7 @@ var env environment // when all running actors have stopped. Error and log messages will be printed. // The correct way to use this function is to have it be the only thing in main: // -// func main () { +// func main() { // camfish.Run("name", "what it does", new(SomeActor), new(AnotherActor)) // } // @@ -50,21 +50,22 @@ var env environment // is configurable, but by default it is 8 minutes. The vast majority of // actors should initialize in under 100 milliseconds. // -// 70. Running: Actors which implement [Runnable] are run, each in their own -// goroutine. The environment is able to restart actors which have failed, -// which entails resetting the actor if it implements [Resettable], and -// running the actor again within the same goroutine. If an actor does not -// run for a meaningful amount of time after resetting/initialization -// before failing, it is considered erratic and further attempts to restart -// it will be spaced by a limited, constantly increasing time interval. The -// timing is configurable, but by default the threshold for a meaningful -// amount of runtime is 16 seconds, the initial delay interval is 8 -// seconds, the interval increase per attempt is 8 seconds, and the maximum -// interval is one hour. Additionally, programs which implement [Trimmable] -// will be trimmed regularly whenever they are running. The trimming -// interval is also configurable, but by default it is once every minute. -// When an actor which implements [Resettable] is reset, it is given a -// configurable timeout, which is 8 minutes by default. +// 70. Running: Actors which implement [Runnable] or [RunShutdownable] are +// run, each in their own goroutine. The environment is able to restart +// actors which have failed, which entails resetting the actor if it +// implements [Resettable], and running the actor again within the same +// goroutine. If an actor does not run for a meaningful amount of time +// after resetting/initialization before failing, it is considered erratic +// and further attempts to restart it will be spaced by a limited, +// constantly increasing time interval. The timing is configurable, but by +// default the threshold for a meaningful amount of runtime is 16 seconds, +// the initial delay interval is 8 seconds, the interval increase per +// attempt is 8 seconds, and the maximum interval is one hour. +// Additionally, programs which implement [Trimmable] will be trimmed +// regularly whenever they are running. The trimming interval is also +// configurable, but by default it is once every minute. When an actor +// which implements [Resettable] is reset, it is given a configurable +// timeout, which is 8 minutes by default. // // 80. Shutdown: This can be triggered by all actors being removed from the // environment, a catastrophic error, [Done] being called, or the program