fix session context overwrite when logSessionId not set #2115

Merged
lunny merged 2 commits from finelog/xorm:fix_sess_ctx_overwrite into master 2022-03-31 09:20:30 +00:00
Contributor

ref pr #2053

i think the previous fix has some issue
for example, i'm using session like this:

// logSessionID == false
engine := NewEngine()

// use ctx.SessionId to distinguish uniq request id
cxt := context.WithValue(parent, log.SessionIDKey, "some unique request id")
session := engine.NewSession().Context(ctx)

however, with pr 2053, session.Context can't get SessionId from ctx.

this pr fix abrove issue, overwrite session.Context() only when engine.logSessionID == true

please check it out,thanks!

ref pr https://gitea.com/xorm/xorm/pulls/2053 i think the previous fix has some issue for example, i'm using session like this: ```go // logSessionID == false engine := NewEngine() // use ctx.SessionId to distinguish uniq request id cxt := context.WithValue(parent, log.SessionIDKey, "some unique request id") session := engine.NewSession().Context(ctx) ``` however, with pr 2053, `session.Context` can't get SessionId from ctx. this pr fix abrove issue, overwrite `session.Context()` only when `engine.logSessionID == true` please check it out,thanks!
finelog added 1 commit 2022-02-22 09:39:30 +00:00
fix session context overwrite when logSessionId not set
All checks were successful
continuous-integration/drone/pr Build is passing
28600a89ea
finelog changed title from fix session context overwrite when logSessionId not set to WIP: fix session context overwrite when logSessionId not set 2022-02-23 09:57:49 +00:00
finelog changed title from WIP: fix session context overwrite when logSessionId not set to fix session context overwrite when logSessionId not set 2022-02-23 09:57:55 +00:00
finelog changed title from fix session context overwrite when logSessionId not set to WIP: fix session context overwrite when logSessionId not set 2022-02-23 10:04:48 +00:00
finelog changed title from WIP: fix session context overwrite when logSessionId not set to WIP: fix session context overwrite when logSessionId not set 2022-02-23 10:04:48 +00:00
finelog changed title from WIP: fix session context overwrite when logSessionId not set to fix session context overwrite when logSessionId not set 2022-02-23 10:04:54 +00:00
lunny added 1 commit 2022-03-31 06:26:30 +00:00
Merge branch 'master' into fix_sess_ctx_overwrite
All checks were successful
continuous-integration/drone/pr Build is passing
43cdbc29b5
lunny merged commit d195040cb9 into master 2022-03-31 09:20:30 +00:00
finelog deleted branch fix_sess_ctx_overwrite 2022-04-01 02:18:35 +00:00
Author
Contributor

thanks

thanks
Sign in to join this conversation.
No description provided.