-
-
Notifications
You must be signed in to change notification settings - Fork 777
Fixed an issue where getting permissions from DB would fail at times #6953
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
base: release/10.2.2
Are you sure you want to change the base?
Fixed an issue where getting permissions from DB would fail at times #6953
Conversation
While working on dnnsoftware#6952 this would fail after each restart for some reason, with this change it no longer does. I don't know if this is a good fix performance-wise, any ideas @bdukes ?
I believe the first approach is better for performance. Given that Provider is a high-traffic object in our codebase, using static readonly ensures we only resolve the dependency once, whereas the current => syntax triggers a factory lookup on every single call. |
DNN Platform/Library/Security/Permissions/PermissionController.cs
Outdated
Show resolved
Hide resolved
|
I pushed an additional commit that makes it better, however I am scared that this hides an underlying issue with DI or the ComponentModel pattern thing. So I put this in draft. It looks like I also cannot place a module on a page, $.dnnSf is not on the page and I'll investigate that too which may show an issue affecting both maybe... |
I'm curious if doing it this way would be more feasible. |
|
IMHO I think the way now proposed is fine with the call inside the callback. The DataProvider.Instance() is only called when the cache expires. I'd prefer not to put anything at class level as down the line someone may inadvertently use it which is not desirable. It's only there for the callback. |
| { | ||
| private static readonly DataProvider Provider = DataProvider.Instance(); | ||
| private readonly IEventLogger eventLogger; | ||
| private readonly DataProvider dataProvider; |
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.
This change has me slightly confused.
Why are we keeping a dataProvider private that is readony only, and introducing a new static, but changing some implementations to use dataProvider and others to use Provider?
I would expect all to the be the same. The static nature of that provider I guess also scares me, but maybe that is the proper intention context.

While working on #6952 this would fail after each restart for some reason, with this change it no longer does. I don't know if this is a good fix performance-wise, any ideas @bdukes ?
Summary