-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working on settings / config sources. #4164
Conversation
|
src/OrchardCore/OrchardCore/Environment/Shell/ShellSettingsManager.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore/Environment/Shell/SingleShellSettingsManager.cs
Outdated
Show resolved
Hide resolved
As i have time i will re-think about making save settings async. |
@@ -339,7 +346,7 @@ public Task ReloadShellContextAsync(ShellSettings settings) | |||
context.Release(); | |||
} | |||
|
|||
return GetOrCreateShellContextAsync(settings); | |||
return GetOrCreateShellContextAsync(settings, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Load the settings before:
if (settings.State != TenantState.Initializing)
{
settings = _shellSettingsManager.LoadSettings(settings.Name);
}
Remove the boolean to reload settings.
@sebastienros i think this one is ready, we already reviewed it together ;) Update: Fixes #4734 |
So, after merging dev, i began to update the files related to #2450
Maybe i misunderstood some things, so i would need to tried it, well understand it and then update it. The problem with my PR, idem for #4001, is that, if it takes a too long time to be merged, it becomes not so easy to maintain, e.g to fix those that are related but merged before. So not so motivated, i would be if this PR and #4001 will not take again a long time to be merged. |
This is on the continuation of #4001 defining caching rules, also related to #4107.
One rule being to update internal data by re-reading a store (shared or not), not just relying on the fact that we have updated them just before storing them. There are others places that would need to be updated, here i applied this rule to the shell settings / configurations.
So, here when we update a tenant and reload it, the related shell settings are reloaded so that after having updated a given tenant through
tenants.json
or its specificappsettings.json
, if i reload it through the admin i can see the changes under the tenants page (was not the case before).I think it's a more complete tenant reloading. Then in a distributed environment where a distributed event will be sent on a tenant reloading, on each instance this tenant will be reloaded by loading and using the updated settings coming e.g from a shared source.
If an library API allows to update a shared source from an OC app e.g through the admin, the distributed event could be sent automatically. We could then think about a config provider based on Redis, maybe after on blob, database ...
Note: Maybe an idea to also have in the admin a soft app restart that would reload all tenants.
Note: For a config provider based on the database we could use a light scope for a given tenant as we do to see if a given shell descriptor exists. Or a
IDbConnectionAccessor
as used inShellDescriptorManager
byUpgradeFromBeta2
. In both case, on saving a new transaction would need to be created and committed.Question: Can we remove
UpgradeFromBeta2()
, hmm at least in the 3.0 branch, notice that this code is always executed when creating a new tenant.