2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-09-20 02:55:54 +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) { func (mux *ServeMux) Use(mws ...MiddlewareFunc) {
mux.mu.Lock() mux.mu.Lock()
defer mux.mu.Unlock() defer mux.mu.Unlock()
for _, fn := range mws { mux.mws = append(mux.mws, mws...)
mux.mws = append(mux.mws, fn)
}
} }
// NotFound returns an error indicating that the handler was not found for the given task. // NotFound returns an error indicating that the handler was not found for the given task.