Added context.Context to stop and correctly stop metrics now

This commit is contained in:
Pablu23
2025-10-15 13:27:09 +02:00
parent f4ca559a26
commit e90c211d0f
5 changed files with 26 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
package middleware
import (
"context"
"net/http"
"slices"
)
@@ -8,7 +9,7 @@ import (
type Middleware interface {
Use(http.Handler) http.Handler
Manage()
Stop()
Stop(context.Context)
}
type Pipeline struct {
@@ -33,9 +34,9 @@ func (p *Pipeline) Use() func(http.Handler) http.Handler {
}
}
func (p *Pipeline) Stop() {
func (p *Pipeline) Stop(ctx context.Context) {
for _, m := range p.middleware {
m.Stop()
m.Stop(ctx)
}
}