always log scanner exit code when it is non-zero (#2670)

* always log scanner exit code when it is non-zero

* remove test abort
This commit is contained in:
Jason Dove
2025-11-26 12:50:19 -06:00
committed by GitHub
parent d7952e4cfa
commit bcea96d53a
13 changed files with 60 additions and 20 deletions
+1
View File
@@ -89,6 +89,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Validation tool in the UI still uses Newtonsoft.Json.Schema (with 1000/hr limit) as the error output is easier to understand
- Fix editing scripted and sequential playouts when using MySql
- Fix HLS Direct streams remaining open after client disconnect
- Always log scanner exit code when it is non-zero
### Changed
- Classic schedules: `Refresh` classic playouts from playout list; do not `Reset` them
@@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Emby;
@@ -21,7 +22,12 @@ public class CallEmbyCollectionScannerHandler : CallLibraryScannerHandler<Synchr
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallEmbyCollectionScannerHandler> logger) : base(
dbContextFactory,
configElementRepository,
runtimeInfo,
logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Emby;
@@ -22,8 +23,9 @@ public class CallEmbyLibraryScannerHandler : CallLibraryScannerHandler<ISynchron
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallEmbyLibraryScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -7,6 +7,7 @@ using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Emby;
@@ -19,8 +20,9 @@ public class CallEmbyShowScannerHandler : CallLibraryScannerHandler<SynchronizeE
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallEmbyShowScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Jellyfin;
@@ -21,7 +22,12 @@ public class CallJellyfinCollectionScannerHandler : CallLibraryScannerHandler<Sy
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallJellyfinCollectionScannerHandler> logger) : base(
dbContextFactory,
configElementRepository,
runtimeInfo,
logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Jellyfin;
@@ -22,8 +23,9 @@ public class CallJellyfinLibraryScannerHandler : CallLibraryScannerHandler<ISync
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallJellyfinLibraryScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -7,6 +7,7 @@ using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Jellyfin;
@@ -19,8 +20,9 @@ public class CallJellyfinShowScannerHandler : CallLibraryScannerHandler<Synchron
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallJellyfinShowScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -11,13 +11,16 @@ using Serilog;
using Serilog.Core;
using Serilog.Events;
using Serilog.Formatting.Compact.Reader;
using Microsoft.Extensions.Logging;
using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace ErsatzTV.Application.Libraries;
public abstract class CallLibraryScannerHandler<TRequest>(
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IRuntimeInfo runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger logger)
{
protected static string GetBaseUrl(Guid scanId) => $"http://localhost:{Settings.UiPort}/api/scan/{scanId}";
@@ -42,6 +45,7 @@ public abstract class CallLibraryScannerHandler<TRequest>(
if (process.ExitCode != 0)
{
logger.LogWarning("ErsatzTV.Scanner exited with code {ExitCode}", process.ExitCode);
return BaseError.New($"ErsatzTV.Scanner exited with code {process.ExitCode}");
}
}
@@ -64,7 +68,7 @@ public abstract class CallLibraryScannerHandler<TRequest>(
// writes in UTC
LogEvent logEvent = LogEventReader.ReadFromString(s);
ILogger log = Log.Logger;
Serilog.ILogger log = Log.Logger;
if (logEvent.Properties.TryGetValue("SourceContext", out LogEventPropertyValue property))
{
log = log.ForContext(
@@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.MediaSources;
@@ -22,8 +23,9 @@ public class CallLocalLibraryScannerHandler : CallLibraryScannerHandler<IScanLoc
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallLocalLibraryScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Plex;
@@ -21,7 +22,12 @@ public class CallPlexCollectionScannerHandler : CallLibraryScannerHandler<Synchr
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallPlexCollectionScannerHandler> logger) : base(
dbContextFactory,
configElementRepository,
runtimeInfo,
logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Plex;
@@ -22,8 +23,9 @@ public class CallPlexLibraryScannerHandler : CallLibraryScannerHandler<ISynchron
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallPlexLibraryScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -10,6 +10,7 @@ using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using ErsatzTV.Infrastructure.Extensions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Plex;
@@ -22,7 +23,9 @@ public class CallPlexNetworkScannerHandler : CallLibraryScannerHandler<Synchroni
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallPlexNetworkScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}
@@ -7,6 +7,7 @@ using ErsatzTV.Core.Interfaces.Repositories;
using ErsatzTV.FFmpeg.Runtime;
using ErsatzTV.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace ErsatzTV.Application.Plex;
@@ -19,8 +20,9 @@ public class CallPlexShowScannerHandler : CallLibraryScannerHandler<SynchronizeP
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallPlexShowScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}