2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-11-10 03:21:55 +08:00

chore: replace loop with mux.mws = append(mux.mws, mws...)

This commit is contained in:
guoguangwu 2023-07-07 10:03:11 +08:00 committed by Ken Hibino
parent 5bef53d1ac
commit 123d560a44

View File

@ -144,9 +144,7 @@ func (mux *ServeMux) HandleFunc(pattern string, handler func(context.Context, *T
func (mux *ServeMux) Use(mws ...MiddlewareFunc) {
mux.mu.Lock()
defer mux.mu.Unlock()
for _, fn := range mws {
mux.mws = append(mux.mws, fn)
}
mux.mws = append(mux.mws, mws...)
}
// NotFound returns an error indicating that the handler was not found for the given task.