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
|
// Handle gin route with context
|
||||||
func (ctx *Context) API(handler func(ctx *Context)) func(*gin.Context) {
|
func (ctx *Context) API(handler func(ctx *Context)) func(*gin.Context) {
|
||||||
return func(c *gin.Context) {
|
return func(gctx *gin.Context) {
|
||||||
ctx.Context = c
|
context := Context{
|
||||||
handler(ctx)
|
Context: gctx,
|
||||||
|
Config: ctx.Config,
|
||||||
|
}
|
||||||
|
handler(&context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo: Check if this could cause a problem
|
|
||||||
|
Loading…
Reference in New Issue
Block a user