-
Notifications
You must be signed in to change notification settings - Fork 3
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
OSOE-548: Upgrade to Orchard Core 1.6 in Hosting-Tenants #55
Conversation
Lombiq.Hosting.Tenants.FeaturesGuard/Handlers/FeaturesEventHandler.cs
Outdated
Show resolved
Hide resolved
@Psichorex Okay, see my #55 (comment) |
Finally I think you are right to use an For info in OC I suggested a PR to have a Then I think that on any feature enabled/disabled event, that can be related to a condition or conditional feature, you can trigger a deferred task but as said only once by using a local boolean e.g. So at least we have 2 deferred tasks, the one of the shell feature and ours, and as a maximum, if we enable/disable features, 2 deferred tasks again for a total of 4 deferred tasks. So here what I quickly did for testing and to show the idea.
Notice that we no longer use |
@jtkech Thanks for all the information. This might help the usage of this whole service on condition there is a slight misspelling that would otherwise be hard to find. Everything as far I have tested is working now. |
@Psichorex All good then!
|
@jtkech I would rather avoid removing Also I tried the local boolean prior you mentioning it because I thought about that already but it is causing errors. If you think that the current solution is sufficient please leave an approved label on the PR as you have highly contributed on this review for which I am really grateful. |
Lombiq.Hosting.Tenants.FeaturesGuard/Handlers/FeaturesEventHandler.cs
Outdated
Show resolved
Hide resolved
Lombiq.Hosting.Tenants.FeaturesGuard/Handlers/FeaturesEventHandler.cs
Outdated
Show resolved
Hide resolved
@Psichorex No problem and sorry if I bother you a little ;) I only describe how i think it should be done.
For me there is only one feature, change the state of conditionals based on the state of their conditions. In the sample code (see below) I introduced some checkings, e.g you can't enable a
This is not a good reason, it should also work with a recipe (a setup one or not) disabling multiple features, anyway disabling a single feature may disable multiple ones through the dependency graph.
As I have tried it doesn't behave like this, in a given scope by using a boolean our deferred task is triggered only once. But yes, if it enables/disables feature(s), our handler is called again in another deferred task (and scope) with the boolean equal to false, so we trigger our deferred task a second (and last) time but normally for nothing (unless another thread/process changed the features states). But yes, as it is currently done without the bool, a deferred task is triggered for each feature to enable. Also for info, yes in the deferred task you should resolve again scoped services as we are in a different scope. Yes, you can reference a tenant singleton, but in that case better to init a variable in the handler So I think it is worth to try the following where I introduced some additional checkings as mentioned above, quickly done so I could have made a mistake, otherwise if it doesn't work it would mean that there is something else to understand and fix.
|
@jtkech I reworked the whole Handler based on your solution. |
I got it, yes, but it's up to Roland to reply. |
For me doing anything in Feature Manager never executes the DefferedTask again. So locally the functionality for me with a local boolean is nit working as desired per Piedone. I will double check it but I was not able to catch any breakpoints after the tenant was set up. |
Yes please.
That's the weird thing for me ;) How a boolean held by a scoped service can be then always equal to true? If it still doesn't work for you, can you share a simple project and repro steps? So that I could check it with the exact same code, thanks. |
Upgrading Lombiq.Tests.UI.* package reference version
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.
Address the remaining remarks of JT.
OSOE-641: Fix remaining issues for the Orchard Core 1.6 upgrade in Hosting-Tenants
@jtkech Hi JT I found the problem was caused by Rider suggesting that the boolean should be |
@Piedone That |
It's just that Helpful Libraries got an update since the most recent NuGet alpha, so I'm publishing a new package of it too. |
Okay cool then. Only one thing, you set the boolean to true in the wrong place, should be set before triggering the deferred task, not inside the deferred task itself, this is not an
Otherwise deferred tasks would be still triggered, anyway not so good to reference a field of a service resolved from a scope that is no longer valid, better to use an intermediate var but normally for read only. |
@jtkech Thank you so much for all the help and knowledge you gave here. I really appriciate it. |
@Psichorex no problem, thanks for the last fix |
# Conflicts: # Lombiq.Hosting.Tenants.FeaturesGuard.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs
# Conflicts: # Lombiq.Hosting.Tenants.Admin.Login/Lombiq.Hosting.Tenants.Admin.Login.csproj # Lombiq.Hosting.Tenants.EnvironmentRobots.Tests.UI/Lombiq.Hosting.Tenants.EnvironmentRobots.Tests.UI.csproj # Lombiq.Hosting.Tenants.FeaturesGuard.Tests.UI/Lombiq.Hosting.Tenants.FeaturesGuard.Tests.UI.csproj # Lombiq.Hosting.Tenants.FeaturesGuard/Lombiq.Hosting.Tenants.FeaturesGuard.csproj # Lombiq.Hosting.Tenants.IdleTenantManagement.Tests.UI/Lombiq.Hosting.Tenants.IdleTenantManagement.Tests.UI.csproj # Lombiq.Hosting.Tenants.Maintenance.Tests.UI/Lombiq.Hosting.Tenants.Maintenance.Tests.UI.csproj # Lombiq.Hosting.Tenants.Maintenance/Lombiq.Hosting.Tenants.Maintenance.csproj # Lombiq.Hosting.Tenants.Management/Lombiq.Hosting.Tenants.Management.csproj # Lombiq.Hosting.Tenants.MediaStorageManagement.Tests.UI/Lombiq.Hosting.Tenants.MediaStorageManagement.Tests.UI.csproj # Lombiq.Hosting.Tenants.MediaStorageManagement/Lombiq.Hosting.Tenants.MediaStorageManagement.csproj
OSOE-548