Fix possible mutex problem (Create context > Reinsert values for handler)
This commit is contained in:
parent
04f327707e
commit
5e533c01cb
@ -42,10 +42,11 @@ func New(cfg *config.Config) *Context {
|
||||
|
||||
// Handle gin route with context
|
||||
func (ctx *Context) API(handler func(ctx *Context)) func(*gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
ctx.Context = c
|
||||
handler(ctx)
|
||||
return func(gctx *gin.Context) {
|
||||
context := Context{
|
||||
Context: gctx,
|
||||
Config: ctx.Config,
|
||||
}
|
||||
handler(&context)
|
||||
}
|
||||
}
|
||||
|
||||
// Todo: Check if this could cause a problem
|
||||
|
Loading…
Reference in New Issue
Block a user