-
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 caching and tokens #4001
Merged
Merged
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
05a9c42
Working on caching an tokens
jtkech 5c0c4b8
wip
jtkech 1a7affc
wip
jtkech e0bc747
wip.
jtkech b086ae4
Some comments
jtkech db21825
Invalidates the cache at the end of the transaction, right now only d…
jtkech a05dd5f
DeferredSignalToken to invalidate caches e.g after the session is com…
jtkech 6e81fc3
Minor changes
jtkech 9fb2c29
Little updates for some syncing between the caching and async branches.
jtkech a50d3bf
Ensures that a deferred signal for a given key is sent once at the en…
jtkech a14c6a7
Re-introduces and uses the DeferredSignalToken extension helper.
jtkech 4a65c7d
2 places where the token was still get after consuming data.
jtkech e9180d8
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 34c5b50
Final version of "ContentDefinitionManager" here because we keep it n…
jtkech 05e85ba
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech eb046aa
RoleClaims thread safety
jtkech fdc4742
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 1335f17
User thread safety
jtkech 3d6ec9d
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech b1a1a96
Update after merging dev
jtkech adbb18b
Revertd changes related to Users and Roles.
jtkech 6564933
Missing reverted update.
jtkech 2a29015
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 521eaec
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 24e5bb3
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 907ce5b
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech ada4684
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 6d498b9
Updates after merging dev
jtkech c73d921
Minor change to restart the CI
jtkech 56fa97e
Idem.
jtkech 6f04b8c
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech fbfdc62
wip
jtkech 700d0ea
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 4b6e37e
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech c728b3b
Re-introduce roles immutability
jtkech 6e5bd58
Minor changes
jtkech 514e86a
Get / load pattern for AdminMenu through #4612 keeping other caching …
jtkech 1f1080a
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 6b18fbb
Get / Load pattern for Roles.
jtkech aaa9787
Don't save default value and refresh the cache in an isolated scope.
jtkech fd1321c
Uses sesion.Detach()
jtkech f46d60b
Get / Load pattern for Templates.
jtkech a4dd07c
Load / Get patter for SiteSettings.
jtkech 356f361
Get / Load pattern for Queries.
jtkech a4431c0
Revert some previous changes no more required with the new pattern.
jtkech 0de3de7
Get / Load pattern for BackgroundTaskSettings.
jtkech f9d2a8f
Get / Load pattern for Layers.
jtkech 07e70a3
ISessionHelper to LOAD for update / GET for caching.
jtkech e4d92cf
Use SessionHelper for SiteService
jtkech 390ab72
Use SessionHelper for AdminMenuService.
jtkech 20184a6
Use SessionHelper for other servies.
jtkech 8153186
Wip on GET / LOAD pattern for content definitions
jtkech b164c14
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech a86671a
GET / LOAD pattern for types / parts definitions.
jtkech a1f7eb1
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 2ec02a5
Revert testing code, to be continued maybe in another PR.
jtkech 9944c2b
Prevents a deferred task lambda from holding a ref on a scoped service.
jtkech 948a49e
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech ce3e29d
Merge remote-tracking branch 'origin/dev' into jtkech/caching
jtkech 54c75c0
Little formatting
jtkech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why? Is a User object used in concurrent threads?
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.
As i remember, there are some places where we mutate it and i checked that we act on a same shared instance.
Let me some time to retrieve an example
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.
E.g in
UserStore.AddToRoleAsync()
line 332That becomes here
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.
But only one thread accesses this user instance, so the list is thread-safe.
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.
Yes normally but just tried 2 concurrent editing (by using a break point) of the same user, i could see that the 2 concurrent thread are mutating the same user instance and then its roles collection.
The other problem is when we are using / enumerating on e.g roleNames while mutating it.
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.
Interesting. Where are we mutating and iterating at the same time, if not on two different thread.
This is worrying. Can you explain how that happens?
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.
UserManager
is scoped, it resolvesUserStore
which is scoped too, which usesSession
to load a user. In the end I don't understand how two thread would access the same user instance, unless we have some wrong parallel code.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.
Okay let me check again
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.
Oh, just retried, you're right there are 2 different instances, i don't know what i did, maybe too tired ;) These were some of the last changes i did as for others singletons and without doing the above test, indeed there are all scoped services, i'm stupid.
Thanks, i will revert all the changes around user and roles.
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.
So, i don't know why i did here the same changes as for other services but using a singleton cache.
Sorry, i reverted the changes related to users and roles.