(new): expand runtime APIs
(fix): harden concurrent lifecycle (tests): add regression coverage (doc): update v1.2 guidance
This commit is contained in:
+7
-2
@@ -257,10 +257,13 @@ func (bot *Bot[T]) CloseWebhook() error {
|
||||
}
|
||||
}
|
||||
if bot.webhookLogger != nil {
|
||||
if err := bot.webhookLogger.Close(); err != nil {
|
||||
e = append(e, err)
|
||||
if bot.webhookLoggerOwned {
|
||||
if err := bot.webhookLogger.Close(); err != nil {
|
||||
e = append(e, err)
|
||||
}
|
||||
}
|
||||
bot.webhookLogger = nil
|
||||
bot.webhookLoggerOwned = false
|
||||
}
|
||||
return errors.Join(e...)
|
||||
}
|
||||
@@ -283,6 +286,7 @@ func (bot *Bot[T]) runWebhookRuntime(ctx context.Context, run func(context.Conte
|
||||
|
||||
if bot.webhookLogger == nil {
|
||||
bot.webhookLogger = utils.CreateLogger("WEBHOOK", bot.GetLoggerLevel(), bot.logFormat, bot.logFormatter)
|
||||
bot.webhookLoggerOwned = true
|
||||
}
|
||||
bot.addTokenReplacer(bot.webhookLogger)
|
||||
bot.ExecRunners(runCtx)
|
||||
@@ -297,6 +301,7 @@ func (bot *Bot[T]) runWebhookRuntime(ctx context.Context, run func(context.Conte
|
||||
cancel()
|
||||
close(bot.updateQueue)
|
||||
<-workersDone
|
||||
bot.middlewareWG.Wait()
|
||||
bot.runnerOnceWG.Wait()
|
||||
bot.runnerBgWG.Wait()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user