Fix potential deadlock when loading feature flags
Fixes https://github.com/metabase/metabase/issues/38009 ### Description This makes the feature flag loading code more robust by making the function re-entrant. To understand how this function could deadlock before, see the description in https://github.com/metabase/metabase/pull/38027. It works by ensuring that the call to initialize the nonce comes from the same thread that initially locked on fetching the tokens. There is a subtle behavior change here - was allow for a 10s timeout on each call individually now. Since it is unlikely that both endpoints will timeout consecutively, and the combined wait time is still fairly short, I think this is OK. ### How to verify You can use the same steps as https://github.com/metabase/metabase/pull/38027, either of these PRs are sufficient to fix the bug.
Please register or sign in to comment