keep an applied invalidation from inducing a write that publishes back
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
2026-09-21 00:24:01 +10:00
parent b662ffa48f
commit a9d6c749fb
8 changed files with 312 additions and 6 deletions
@@ -176,7 +176,7 @@ namespace Emby.Server.Implementations.AppBase
OnConfigurationUpdated();
InvalidationBus.Publish(ConfigurationInvalidationScope.SystemConfiguration, null);
InvalidationBus.PublishLocalWrite(ConfigurationInvalidationScope.SystemConfiguration, null);
}
/// <summary>
@@ -359,7 +359,7 @@ namespace Emby.Server.Implementations.AppBase
OnNamedConfigurationUpdated(key, configuration);
InvalidationBus.Publish(ConfigurationInvalidationScope.NamedConfiguration, key);
InvalidationBus.PublishLocalWrite(ConfigurationInvalidationScope.NamedConfiguration, key);
}
/// <inheritdoc />
@@ -802,8 +802,10 @@ namespace Emby.Server.Implementations
var requiresRestart = false;
var networkConfiguration = ConfigurationManager.GetNetworkConfiguration();
// Don't do anything if these haven't been set yet
if (HttpPort != 0 && HttpsPort != 0)
// Don't do anything if these haven't been set yet, and don't clear the authorization flag on
// behalf of another instance: it already wrote that flag along with the port change, so
// repeating the save here only races it.
if (HttpPort != 0 && HttpsPort != 0 && !ConfigurationInvalidationContext.IsApplyingRemoteInvalidation)
{
// Need to restart if ports have changed
if (networkConfiguration.InternalHttpPort != HttpPort
@@ -48,6 +48,11 @@ namespace Emby.Server.Implementations.Configuration
{
try
{
// Applying re-raises the same update events a local save raises, so the in-process
// consumers re-read. The scope tells those consumers that the write was somebody else's,
// so the ones that answer an update by writing neither repeat it nor publish it back.
using var scope = ConfigurationInvalidationContext.BeginApply();
switch (invalidation.Scope)
{
case ConfigurationInvalidationScope.SystemConfiguration: