Fix context merging
This commit is contained in:
parent
7d73b9cdd4
commit
336ea2ebac
|
@ -91,7 +91,7 @@ func ReverseProxyIpFrom(ctx context.Context) (string, bool) {
|
|||
return v, ok
|
||||
}
|
||||
|
||||
func AddValues(ctx context.Context) context.Context {
|
||||
func AddValues(ctx, requestCtx context.Context) context.Context {
|
||||
keys := []contextKey{
|
||||
User,
|
||||
Username,
|
||||
|
@ -102,7 +102,7 @@ func AddValues(ctx context.Context) context.Context {
|
|||
ClientUniqueId,
|
||||
}
|
||||
for _, key := range keys {
|
||||
if v, ok := ctx.Value(key).(string); ok {
|
||||
if v, ok := requestCtx.Value(key).(string); ok {
|
||||
ctx = context.WithValue(ctx, key, v)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,16 +14,16 @@ import (
|
|||
)
|
||||
|
||||
type scanner2 struct {
|
||||
ctx context.Context
|
||||
ds model.DataStore
|
||||
processCtx context.Context
|
||||
ds model.DataStore
|
||||
}
|
||||
|
||||
func New(ctx context.Context, ds model.DataStore) scanner.Scanner {
|
||||
return &scanner2{ctx: ctx, ds: ds}
|
||||
return &scanner2{processCtx: ctx, ds: ds}
|
||||
}
|
||||
|
||||
func (s *scanner2) RescanAll(ctx context.Context, fullRescan bool) error {
|
||||
ctx = request.AddValues(s.ctx)
|
||||
func (s *scanner2) RescanAll(requestCtx context.Context, fullRescan bool) error {
|
||||
ctx := request.AddValues(s.processCtx, requestCtx)
|
||||
|
||||
libs, err := s.ds.Library(ctx).GetAll()
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue