(new): expand runtime APIs
Golang lint / lint (push) Successful in 58s
Golang lint / lint (pull_request) Successful in 13m10s

(fix): harden concurrent lifecycle
(tests): add regression coverage
(doc): update v1.2 guidance
This commit is contained in:
2026-08-20 11:08:45 +03:00
parent 29b208eeec
commit 24040fe164
37 changed files with 1129 additions and 157 deletions
+2 -2
View File
@@ -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()