fix(410): log scan cancellation below ERROR (user-initiated, not a failure)
Build ErsatzTV Image / CI image pin matches docker/ci (pull_request) Successful in 6s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 5s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 8s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 6m56s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 7s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 39s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 14m20s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 19m2s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Build ErsatzTV Image / CI image pin matches docker/ci (pull_request) Successful in 6s
Build ErsatzTV Image / Docs update reminder (pull_request) Successful in 5s
Build ErsatzTV Image / decisions.md append-only (pull_request) Successful in 8s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 6m56s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 7s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 39s
Build ErsatzTV Image / Functional E2E (curl contracts) (pull_request) Successful in 14m20s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 19m2s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
Scan cancellation surfaces as ScanCanceled, an ordinary BaseError, so all four scan handlers (Jellyfin/Emby/Plex/local) logged it at ERROR alongside genuine failures. A user cancelling a scan (or a container restart mid-scan) is not an error; this was training operators to ignore scanner ERROR lines, corrosive precisely because #264 showed scanner failures can be silent. Each handler's Left-result loop now branches on `error is ScanCanceled`: logs Information ("Scan of {Name} was canceled") for cancellation, keeps LogError for every other BaseError. No behavior change to LastScan stamping (still correctly skipped on any Left, cancellation included). fixes #410 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using ErsatzTV.Core;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Errors;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Scanner.Core.Interfaces;
|
||||
using ErsatzTV.Scanner.Core.Interfaces.Metadata;
|
||||
@@ -152,13 +153,23 @@ public class ScanLocalLibraryHandler : IRequestHandler<ScanLocalLibrary, Either<
|
||||
|
||||
// a failed path now suppresses the library-level scan time below, so without this the
|
||||
// user sees "Never scanned" with nothing explaining why. The remote scanners log the
|
||||
// same way.
|
||||
// same way. A cancellation is user-initiated, not a failure, so it's logged separately
|
||||
// at a lower level; genuine errors still log at ERROR.
|
||||
foreach (BaseError error in result.LeftToSeq())
|
||||
{
|
||||
_logger.LogError(
|
||||
"Error scanning local library path {Path}: {Error}",
|
||||
libraryPath.Path,
|
||||
error);
|
||||
if (error is ScanCanceled)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Scan of local library path {Path} was canceled",
|
||||
libraryPath.Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogError(
|
||||
"Error scanning local library path {Path}: {Error}",
|
||||
libraryPath.Path,
|
||||
error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user