Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auth: CachingCredentialsSource is concurrency-safe
Previously CachingCredentialsSource was not safe for concurrent use, but was not documented as such so callers tried to use it concurrently anyway. It's realtively straightfoward to use a mutex to guard the internal cache map, so we'll do that here to avoid pushing the synchronization responsibility downstream into callers. This mutex is here only to prevent corrupting our map and it intentionally does not prevent concurrent calls to the underlying credentials source. This means that two concurrent callers might sometimes race to populate the same cache entry, in which case it's unspecified which one will "win" and have its result retained for future calls, but one of them definitely will.
- Loading branch information