fix: graceful shutdown with asynchronous processes - fixes #1022

This commit is contained in:
Julien Neuhart
2025-05-14 15:27:14 +02:00
parent 91757335ac
commit 66317197b6
5 changed files with 69 additions and 5 deletions

View File

@@ -173,10 +173,13 @@ func webhookMiddleware(w *Webhook) api.Middleware {
}
}
w.asyncCount.Add(1)
// As a webhook URL has been given, we handle the request in a
// goroutine and return immediately.
go func() {
defer cancel()
defer w.asyncCount.Add(-1)
// Call the next middleware in the chain.
err := next(c)