Document RunShutdownable in Run

This commit is contained in:
Sasha Koshka 2025-01-30 18:28:16 -05:00
parent 2cb1e5cb3a
commit b4c55decc6

33
run.go
View File

@ -9,7 +9,7 @@ var env environment
// when all running actors have stopped. Error and log messages will be printed. // 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: // 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)) // 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 // is configurable, but by default it is 8 minutes. The vast majority of
// actors should initialize in under 100 milliseconds. // actors should initialize in under 100 milliseconds.
// //
// 70. Running: Actors which implement [Runnable] are run, each in their own // 70. Running: Actors which implement [Runnable] or [RunShutdownable] are
// goroutine. The environment is able to restart actors which have failed, // run, each in their own goroutine. The environment is able to restart
// which entails resetting the actor if it implements [Resettable], and // actors which have failed, which entails resetting the actor if it
// running the actor again within the same goroutine. If an actor does not // implements [Resettable], and running the actor again within the same
// run for a meaningful amount of time after resetting/initialization // goroutine. If an actor does not run for a meaningful amount of time
// before failing, it is considered erratic and further attempts to restart // after resetting/initialization before failing, it is considered erratic
// it will be spaced by a limited, constantly increasing time interval. The // and further attempts to restart it will be spaced by a limited,
// timing is configurable, but by default the threshold for a meaningful // constantly increasing time interval. The timing is configurable, but by
// amount of runtime is 16 seconds, the initial delay interval is 8 // default the threshold for a meaningful amount of runtime is 16 seconds,
// seconds, the interval increase per attempt is 8 seconds, and the maximum // the initial delay interval is 8 seconds, the interval increase per
// interval is one hour. Additionally, programs which implement [Trimmable] // attempt is 8 seconds, and the maximum interval is one hour.
// will be trimmed regularly whenever they are running. The trimming // Additionally, programs which implement [Trimmable] will be trimmed
// interval is also configurable, but by default it is once every minute. // regularly whenever they are running. The trimming interval is also
// When an actor which implements [Resettable] is reset, it is given a // configurable, but by default it is once every minute. When an actor
// configurable timeout, which is 8 minutes by default. // 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 // 80. Shutdown: This can be triggered by all actors being removed from the
// environment, a catastrophic error, [Done] being called, or the program // environment, a catastrophic error, [Done] being called, or the program