Skip to content

Commit

Permalink
fix race
Browse files Browse the repository at this point in the history
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
  • Loading branch information
CabinfeverB committed Jan 20, 2022
1 parent 83c4ca9 commit 10a564e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ type createRouteOption func(route *mux.Route)
// setMethods is used to add HTTP Method matcher for mux.Route
func setMethods(method ...string) createRouteOption {
return func(route *mux.Route) {
methods := make([]string, len(method))
for idx, item := range method {
str := item
methods[idx] = str
}
route.Methods(method...)
}
}
Expand Down Expand Up @@ -146,7 +151,7 @@ func createRouter(prefix string, svr *server.Server) *mux.Router {

serviceBuilder := newServiceMiddlewareBuilder(svr)
register := serviceBuilder.registerRouteHandler
//registerPrefix := serviceBuilder.registerPathPrefixRouteHandler
registerPrefix := serviceBuilder.registerPathPrefixRouteHandler
registerFunc := serviceBuilder.registerRouteHandleFunc

operatorHandler := newOperatorHandler(handler, rd)
Expand All @@ -167,7 +172,7 @@ func createRouter(prefix string, svr *server.Server) *mux.Router {

schedulerConfigHandler := newSchedulerConfigHandler(svr, rd)
apiRouter.PathPrefix("/scheduler-config").Handler(schedulerConfigHandler)
//registerPrefix(apiRouter, "GetSchedulerConfig", "/scheduler-config", schedulerConfigHandler)
registerPrefix(apiRouter, "GetSchedulerConfig", "/scheduler-config", schedulerConfigHandler)

clusterHandler := newClusterHandler(svr, rd)
register(apiRouter, "GetCluster", "/cluster", clusterHandler, getMethod)
Expand Down

0 comments on commit 10a564e

Please sign in to comment.