Rely on request.Context() cancellation#38284
Conversation
3f26ab8 to
9c4a1b4
Compare
|
Hm failure; could this be due to a change in behavior in gorilla/mux? I recall we ran into this at some point, perhaps another attempt to update it |
|
could've been this one #30933 🤔 but think I had another one in mind |
|
Ah! This was the PR #37522 (comment) Same failure |
|
Damnit. |
This fixes an issue with mux usage of context for storing vars. Also the old version is 2 years old. Signed-off-by: Brian Goff <[email protected]>
The cancellable handler is no longer needed as the context that is passed with the http request will be cancelled just like the close notifier was doing. Signed-off-by: Brian Goff <[email protected]>
|
Fixed 🤞 |
9c4a1b4 to
05390c4
Compare
Codecov Report
@@ Coverage Diff @@
## master #38284 +/- ##
=========================================
Coverage ? 36.14%
=========================================
Files ? 610
Lines ? 45285
Branches ? 0
=========================================
Hits ? 16367
Misses ? 26681
Partials ? 2237 |
|
I think I looked into that at the time with @vdemeester and it was because non-existing endpoints were still handled somewhere in our code, but it's been a while 🤔 |
| notFoundHandler := httputils.MakeErrorHandler(pageNotFoundError{}) | ||
| m.HandleFunc(versionMatcher+"/{path:.*}", notFoundHandler) | ||
| m.NotFoundHandler = notFoundHandler | ||
| m.MethodNotAllowedHandler = notFoundHandler |
There was a problem hiding this comment.
gorilla/mux now uses a separate handler for non-existent routes. This changes it back to the old behavior.
There was a problem hiding this comment.
Ah! nice find; perhaps worth adding a comment, explaining why we do this?
There was a problem hiding this comment.
I think the test enforcing it is enough, also git blame.
|
It's green (Ignoring codecov/patch) 🎉 |
The cancellable handler is no longer needed as the context that is
passed with the http request will be cancelled just like the close
notifier was doing.
Also updates gorilla/mux... This fixes an issue with mux usage of context for storing vars... took me a bit to figure out that calling
mux.Vars(r)after I added my own context torwas messing everything up.Also the old version is 2 years old.