Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9d5dcd7 commit a8464cdCopy full SHA for a8464cd
engine/api/router.go
@@ -201,7 +201,8 @@ func (r *Router) Handle(uri string, handlers ...*service.HandlerConfig) {
201
}
202
203
f := func(w http.ResponseWriter, req *http.Request) {
204
- ctx := req.Context()
+ ctx, cancel := context.WithCancel(req.Context())
205
+ defer cancel()
206
207
responseWriter := &trackingResponseWriter{
208
writer: w,
@@ -228,7 +229,7 @@ func (r *Router) Handle(uri string, handlers ...*service.HandlerConfig) {
228
229
w.WriteHeader(http.StatusOK)
230
return
231
- observability.Record(ctx, r.Stats.Hits, 1)
232
+ observability.Record(r.Background, r.Stats.Hits, 1)
233
234
//Get route configuration
235
rc := cfg.Config[req.Method]
0 commit comments