(new): expand runtime APIs
(fix): harden concurrent lifecycle (tests): add regression coverage (doc): update v1.2 guidance
This commit is contained in:
+2
-2
@@ -93,7 +93,7 @@ func (r Runner[T]) Every(timeout time.Duration) Runner[T] {
|
||||
// ExecRunners executes all runners registered on the Bot with context-based lifecycle management.
|
||||
//
|
||||
// Execution semantics by configuration:
|
||||
// - every=0, async=true: Runs once in a goroutine (fire and forget).
|
||||
// - every=0, async=true: Runs once in a goroutine; runtime shutdown waits for it.
|
||||
// - every=0, async=false: Runs once synchronously; warns if slower than 2 seconds.
|
||||
// - every>0, async=true: Runs in a loop with the configured interval until ctx.Done().
|
||||
// - every>0, async=false: Skipped with a warning (invalid configuration).
|
||||
@@ -111,7 +111,7 @@ func (bot *Bot[T]) ExecRunners(ctx context.Context) {
|
||||
}
|
||||
|
||||
if runner.every == 0 && runner.async {
|
||||
// One-time async: fire and forget
|
||||
// One-time async: non-blocking startup; runtime shutdown waits for completion.
|
||||
bot.runnerOnceWG.Add(1)
|
||||
go func(r Runner[T]) {
|
||||
defer bot.runnerOnceWG.Done()
|
||||
|
||||
Reference in New Issue
Block a user