fix(server/m7-scan-progress): forward-fix CI — ScanTrigger interface
B-T2 changed Scanner.Scan to take a progressCb parameter, but the ScanTrigger interface in internal/server/server.go was missed. The interface gains the same progressCb arg; the HTTP handler at handleAdminScan passes nil (fire-and-forget triggers don't observe partial tallies). The stubScanner in server_test.go gets the new arg too.
This commit is contained in:
@@ -52,9 +52,11 @@ func (a lidarrUnmonitorAdapter) UnmonitorTrack(ctx context.Context, trackMbid, a
|
||||
}
|
||||
|
||||
// ScanTrigger is the subset of the scanner the HTTP handler needs. Kept as an
|
||||
// interface so tests can stub it without touching the DB.
|
||||
// interface so tests can stub it without touching the DB. The progressCb
|
||||
// parameter (added in m7-scan-progress) lets the orchestrator drive partial-
|
||||
// tally writes; the HTTP handler passes nil for fire-and-forget triggers.
|
||||
type ScanTrigger interface {
|
||||
Scan(ctx context.Context) (library.Stats, error)
|
||||
Scan(ctx context.Context, progressCb func(library.Stats)) (library.Stats, error)
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
@@ -151,7 +153,7 @@ func (s *Server) handleHealthz(w http.ResponseWriter, _ *http.Request) {
|
||||
// Kept synchronous for v1: libraries are small and the operator can tell when
|
||||
// it's done. Async jobs with status polling are a later-milestone concern.
|
||||
func (s *Server) handleAdminScan(w http.ResponseWriter, r *http.Request) {
|
||||
stats, err := s.Scanner.Scan(r.Context())
|
||||
stats, err := s.Scanner.Scan(r.Context(), nil)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err != nil {
|
||||
s.Logger.Error("admin scan failed", "err", err)
|
||||
|
||||
Reference in New Issue
Block a user