fail startup when the quick connect store is unreachable
Read the configured quick connect store during InitializeServices and abort startup, with a log line naming valkey, instead of coming up and failing on the first request that needs the store.
This commit is contained in:
@@ -124,6 +124,12 @@ namespace Emby.Server.Implementations
|
||||
/// </summary>
|
||||
public abstract class ApplicationHost : IServerApplicationHost, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The secret the startup read of the quick connect store looks for. No flow ever mints it, so the
|
||||
/// read is always a miss and only its reachability is being asked about.
|
||||
/// </summary>
|
||||
private const string StartupProbeSecret = "startup-probe";
|
||||
|
||||
/// <summary>
|
||||
/// The disposable parts.
|
||||
/// </summary>
|
||||
@@ -644,6 +650,8 @@ namespace Emby.Server.Implementations
|
||||
/// <returns>A task representing the service initialization operation.</returns>
|
||||
public async Task InitializeServices(IConfiguration startupConfig)
|
||||
{
|
||||
await ProbeQuickConnectStoreAsync().ConfigureAwait(false);
|
||||
|
||||
var localizationManager = (LocalizationManager)Resolve<ILocalizationManager>();
|
||||
await localizationManager.LoadAll().ConfigureAwait(false);
|
||||
|
||||
@@ -652,6 +660,27 @@ namespace Emby.Server.Implementations
|
||||
FindParts();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the quick connect store once here so a store that cannot be reached stops startup, rather
|
||||
/// than being discovered on the first request that needs it. A read rather than a resolve because a
|
||||
/// shared store built with <c>abortConnect=false</c> constructs without touching the network.
|
||||
/// </summary>
|
||||
private async Task ProbeQuickConnectStoreAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
await Resolve<IQuickConnectStore>().GetRequestBySecretAsync(StartupProbeSecret).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogCritical(
|
||||
ex,
|
||||
"Quick connect is configured against the shared valkey/Redis store at {Key} and it is UNREACHABLE, so the server will not start. Bring valkey up, or clear that setting to keep quick connect state on this instance alone.",
|
||||
TranscodeStoreOptions.RedisConnectionStringKey);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private X509Certificate2 GetCertificate(string path, string password)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
|
||||
Reference in New Issue
Block a user