This commit is contained in:
WithoutPants 2025-12-05 09:29:04 +00:00 committed by GitHub
commit 2fabbaff3d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 26 deletions

View file

@ -15,7 +15,6 @@ import (
"github.com/stashapp/stash/pkg/logger" "github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/models" "github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/txn" "github.com/stashapp/stash/pkg/txn"
"github.com/stashapp/stash/pkg/utils"
) )
const ( const (
@ -719,7 +718,7 @@ func (s *scanJob) handleFile(ctx context.Context, f scanFile) error {
// scan zip files with a different context that is not cancellable // scan zip files with a different context that is not cancellable
// cancelling while scanning zip file contents results in the scan // cancelling while scanning zip file contents results in the scan
// contents being partially completed // contents being partially completed
zipCtx := utils.ValueOnlyContext{Context: ctx} zipCtx := context.WithoutCancel(ctx)
if err := s.scanZipFile(zipCtx, f); err != nil { if err := s.scanZipFile(zipCtx, f); err != nil {
logger.Errorf("Error scanning zip file %q: %v", f.Path, err) logger.Errorf("Error scanning zip file %q: %v", f.Path, err)

View file

@ -7,7 +7,6 @@ import (
"time" "time"
"github.com/stashapp/stash/pkg/logger" "github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/utils"
) )
const maxGraveyardSize = 10 const maxGraveyardSize = 10
@ -179,7 +178,8 @@ func (m *Manager) dispatch(ctx context.Context, j *Job) (done chan struct{}) {
j.StartTime = &t j.StartTime = &t
j.Status = StatusRunning j.Status = StatusRunning
ctx, cancelFunc := context.WithCancel(utils.ValueOnlyContext{Context: ctx}) // create a cancellable context for the job that is not canceled by the outer context
ctx, cancelFunc := context.WithCancel(context.WithoutCancel(ctx))
j.cancelFunc = cancelFunc j.cancelFunc = cancelFunc
done = make(chan struct{}) done = make(chan struct{})

View file

@ -1,22 +0,0 @@
package utils
import (
"context"
"time"
)
type ValueOnlyContext struct {
context.Context
}
func (ValueOnlyContext) Deadline() (deadline time.Time, ok bool) {
return
}
func (ValueOnlyContext) Done() <-chan struct{} {
return nil
}
func (ValueOnlyContext) Err() error {
return nil
}