prometheus / common

Go libraries shared across Prometheus components and libraries.
Apache License 2.0
259 stars 306 forks source link

oauth2RoundTripper: Avoid race condition and readability changes. #634

Closed bwplotka closed 1 month ago

bwplotka commented 1 month ago

After @TheSpiritXIII work we noticed the rt.rt == nil was always shared across threads potentially but not locked. This PR fixes that and adjust the flow for readability.

PTAL @TheSpiritXIII

Changes

bwplotka commented 1 month ago

Addressed, thanks! Perhaps there is still room to build some code to unify those rountrippers, maybe put them in separate file etc, but good enough for now 💪🏽