mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-14 11:22:15 +01:00
fix: graceful shutdown with asynchronous processes - fixes #1022
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user