Update locking and caching for OpenIdConnectCachingSecurityTokenProvider#3124
Conversation
|
There's this comment from the other PR: #3118 (comment) |
@mderriey not sure if you saw this ^ |
I did, yes, I replied further down in the thread. Alex's comments make sense to me, but I can't comment on whether they're better than what's in this PR. I opened this PR with the goal of potentially helping other people as much as getting some validation on the changes we've been running in production. As mentioned in the PR description, I now consider this PR yours. I'm happy to contribute my thoughts, but I won't push in one direction or the other as I wouldn't be confident in my knowledge or experience when it comes to multithreading, thread synchronisation, or locking. |
Update locking and caching for
OpenIdConnectCachingSecurityTokenProviderUpdate locking and caching for
OpenIdConnectCachingSecurityTokenProviderDescription
This is a proposed alternative to #3118.
Changes:
Interlocked.Exchangeto ensure a single thread callsConfigurationManager.GetConfigurationAsyncat a time.Thanks for offering me to open a PR for this.
Please get as many eyes as you can on this to validate my assumptions. I don't have much confidence in my multi-threading, locking, and synchronization abilities.
Also, feel free to take over that PR to adjust to your coding preferences; one thing I noticed is the code base seems to prefer using
Interlocked.CompareExchangeoverInterlocked.Exchange.Essentially, this is now yours, although I'll definitely keep an eye on it and answer questions where I can.
Fixes #3078