keep an applied invalidation from inducing a write that publishes back
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user