diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-04 00:17:29 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-04 00:17:29 +0300 |
| commit | 71e004fb4e53ee4ac5c8fb202bad5f5c00dd8dac (patch) | |
| tree | 5b5c817f8418e2777db376999cdffd3ef018239c /cmd/mediaplayer | |
| parent | c68c54b0212ebc8d111b11c6edff82942c3a4463 (diff) | |
task b: inject app context into AdminService and propagate cancellation to background scans
Diffstat (limited to 'cmd/mediaplayer')
| -rw-r--r-- | cmd/mediaplayer/main.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/mediaplayer/main.go b/cmd/mediaplayer/main.go index 4ff8aa3..93eed12 100644 --- a/cmd/mediaplayer/main.go +++ b/cmd/mediaplayer/main.go @@ -80,12 +80,15 @@ func runWithSignal(args []string, sigCh <-chan os.Signal) error { hasher := auth.NewBCryptHasher(12) sm := auth.NewSessionManager(store, clk, time.Duration(cfg.SessionTimeoutHours)*time.Hour) + appCtx, appCancel := context.WithCancel(context.Background()) + defer appCancel() + prober := probe.NewFFProber() thumbGen := thumb.NewFFmpegGenerator() mediaSvc := service.NewMediaService(store, clk, cfg.MediaRoot, thumbGen, prober) fsScanner := scanner.NewFSScannerWithLogger(store, prober, thumbGen, clk, cfg.MediaRoot, logger) - adminSvc := service.NewAdminServiceWithLogger(store, clk, hasher, fsScanner, cfg.MediaRoot, logger) + adminSvc := service.NewAdminServiceWithLogger(store, clk, hasher, fsScanner, cfg.MediaRoot, appCtx, logger) progressSvc := service.NewProgressService(store, clk) authSvc := service.NewAuthService(store, clk, hasher, sm) |
