Fix context merging

This commit is contained in:
Deluan 2023-12-19 07:55:11 -05:00
parent 7d73b9cdd4
commit 336ea2ebac
2 changed files with 7 additions and 7 deletions

View File

@ -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)
}
}

View File

@ -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 {