From 71e004fb4e53ee4ac5c8fb202bad5f5c00dd8dac Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 4 May 2026 00:17:29 +0300 Subject: task b: inject app context into AdminService and propagate cancellation to background scans --- cmd/mediaplayer/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cmd/mediaplayer') 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) -- cgit v1.2.3