Skip to content

Commit

Permalink
feat: pass context to allow tracing
Browse files Browse the repository at this point in the history
Signed-off-by: rogerogers <rogers@rogerogers.com>
  • Loading branch information
rogerogers committed Sep 2, 2024
1 parent 9f07e21 commit 11368d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ func New(name string, store Store) app.HandlerFunc {
return func(ctx gcontext.Context, c *app.RequestContext) {
req, _ := adaptor.GetCompatRequest(&c.Request)
resp := adaptor.GetCompatResponseWriter(&c.Response)
s := &session{name, req, store, nil, false, resp}
req = req.WithContext(ctx)
s := &session{
name: name, request: req, store: store, session: nil, written: false, writer: resp,
}
c.Set(DefaultKey, s)
defer context.Clear(req)
c.Next(ctx)
Expand All @@ -116,7 +119,9 @@ func Many(names []string, store Store) app.HandlerFunc {
req, _ := adaptor.GetCompatRequest(&c.Request)
resp := adaptor.GetCompatResponseWriter(&c.Response)
for _, name := range names {
s[name] = &session{name, req, store, nil, false, resp}
s[name] = &session{
name: name, request: req, store: store, session: nil, written: false, writer: resp,
}
}
c.Set(DefaultKey, s)
defer context.Clear(req)
Expand Down

0 comments on commit 11368d7

Please sign in to comment.