-
Notifications
You must be signed in to change notification settings - Fork 262
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
fix(oidc): make sure we keep track of an ongoing OIDC refresh up to the end #4304
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4304 +/- ##
==========================================
- Coverage 85.09% 85.08% -0.02%
==========================================
Files 274 274
Lines 30191 30190 -1
==========================================
- Hits 25691 25686 -5
- Misses 4500 4504 +4 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Hmm I don't understand this:
When or how can the inner function detach the spawned task? It doesn't do so as far as I can tell, it awaits the join of the task. What am I missing? |
Oh sorry: there was a |
You mean, cancelling the parent doesn't cancel the spawned task in the child? So now you moved the spawn into the parent and this now cancels the spawned task as well? Or is the whole child/parent interaction unimportant and the reason this now works as expected is that the lock guard has been moved into the spawned task? |
The spawned task is never cancelled: using
Exactly: the spawned task now keeps the mutex guard (as an owned mutex) over the entire lifetime of the spawned task. |
Alright, final question then. What does the moving of the spawn from the child to the parent then achieve? Couldn't we just have moved the owned lock guard to be an argument of the child method? |
Makes the code simpler: there's no spawn hidden in the child |
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.
Thanks for the explanation. A regression test would have been nice as well but is probably not easy to write.
…he end There's a lock making sure we're not doing multiple refreshes of an OIDC token at the same time. Unfortunately, this lock could be dropped, if the task spawned by the inner function was detached. The lock must be held throughout the entire detached task's lifetime, which this refactoring ensures, by setting the lock's result after calling the inner function.
2ab7ce3
to
aa43b2c
Compare
Indeed, this requires super perfect control over the timing of responses / API calls. Likely doable, but agreed the value is 🤷 compared to the code changes. |
There's a lock making sure we're not doing multiple refreshes of an OIDC token at the same time. Unfortunately, this lock could be dropped, if the task spawned by the inner function was detached.
The lock must be held throughout the entire detached task's lifetime, which this refactoring ensures, by setting the lock's result after calling the inner function.