diff --git a/ginext/preContext.go b/ginext/preContext.go index a02da80..5957bde 100644 --- a/ginext/preContext.go +++ b/ginext/preContext.go @@ -163,16 +163,16 @@ func (pctx PreContext) Start() (*AppContext, *gin.Context, *HTTPResponse) { ictx, cancel := context.WithTimeout(context.Background(), langext.Coalesce(pctx.timeout, pctx.wrapper.requestTimeout)) + actx := CreateAppContext(pctx.ginCtx, ictx, cancel) + if pctx.persistantData.sessionObj != nil { - err := pctx.persistantData.sessionObj.Init(pctx.ginCtx, ictx) + err := pctx.persistantData.sessionObj.Init(pctx.ginCtx, actx) if err != nil { - cancel() + actx.Cancel() return nil, nil, langext.Ptr(Error(exerr.Wrap(err, "Failed to init session").Build())) } } - actx := CreateAppContext(pctx.ginCtx, ictx, cancel) - return actx, pctx.ginCtx, nil } diff --git a/ginext/session.go b/ginext/session.go index ee1ce5f..0d6283c 100644 --- a/ginext/session.go +++ b/ginext/session.go @@ -6,6 +6,6 @@ import ( ) type SessionObject interface { - Init(g *gin.Context, ctx context.Context) error + Init(g *gin.Context, ctx *AppContext) error Finish(ctx context.Context, resp HTTPResponse) error } diff --git a/goextVersion.go b/goextVersion.go index b636733..b700a35 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.377" +const GoextVersion = "0.0.378" -const GoextVersionTimestamp = "2024-01-14T17:06:42+0100" +const GoextVersionTimestamp = "2024-01-16T15:04:10+0100"