Skip to content

Commit

Permalink
Can't Reload Stream Config Provider (#14499)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtkech authored Oct 12, 2023
1 parent 878b693 commit f988e38
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/OrchardCore/OrchardCore/Shell/ShellSettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public async Task<IEnumerable<ShellSettings>> LoadSettingsAsync()
try
{
await EnsureConfigurationAsync();
await ReloadTenantsSettingsAsync();

var tenants = _tenantsSettingsRoot.GetChildren().Select(section => section.Key);
var allTenants = _configuredTenants.Concat(tenants).Distinct().ToArray();
Expand Down Expand Up @@ -94,8 +95,7 @@ public async Task<IEnumerable<string>> LoadSettingsNamesAsync()
try
{
await EnsureConfigurationAsync();

_tenantsSettingsRoot.Reload();
await ReloadTenantsSettingsAsync();

var tenants = _tenantsSettingsRoot.GetChildren().Select(section => section.Key);
return _configuredTenants.Concat(tenants).Distinct().ToArray();
Expand All @@ -112,8 +112,7 @@ public async Task<ShellSettings> LoadSettingsAsync(string tenant)
try
{
await EnsureConfigurationAsync();

_tenantsSettingsRoot.Reload();
await ReloadTenantsSettingsAsync();

var tenantSettingsBuilder = new ConfigurationBuilder()
.AddConfiguration(_configuration)
Expand Down Expand Up @@ -277,10 +276,6 @@ private async Task EnsureConfigurationAsync()
.Distinct()
.ToArray();

_tenantsSettingsRoot = (await new ConfigurationBuilder()
.AddSourcesAsync(_tenantsSettingsSources))
.Build();

_tenantConfigFactoryAsync = async (tenant, configure) =>
{
await _tenantConfigSemaphore.WaitAsync();
Expand All @@ -304,6 +299,15 @@ private async Task EnsureConfigurationAsync()
_configuration = configuration;
}

private async Task ReloadTenantsSettingsAsync()
{
using var disposable = _tenantsSettingsRoot as IDisposable;

_tenantsSettingsRoot = (await new ConfigurationBuilder()
.AddSourcesAsync(_tenantsSettingsSources))
.Build();
}

public void Dispose()
{
if (_disposed)
Expand Down

0 comments on commit f988e38

Please sign in to comment.