Skip to content

Commit

Permalink
refactor: add mutex lock to the addRoute function
Browse files Browse the repository at this point in the history
  • Loading branch information
luk3skyw4lker committed Jul 16, 2024
1 parent 38efd37 commit f2ef5d4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ func (app *App) register(methods []string, pathRaw string, group *Group, handler
}

func (app *App) addRoute(method string, route *Route, isMounted ...bool) {
app.mutex.Lock()
defer app.mutex.Unlock()

// Check mounted routes
var mounted bool
if len(isMounted) > 0 {
Expand Down

0 comments on commit f2ef5d4

Please sign in to comment.