Using FallbackCredentialsFactory in a thead safe way #2487
-
Continuation of this discussion: #2484 I'm using FallbackCredentialsFactory.GetCredentials to retrieve aws credentials. Additionally I want to clear a cached credentials generator (here), in case if the previously cached generator has failed, to run all retrieving creds logic from the beginning. All works fine other than FallbackCredentialsFactory is not thread safe. To solve it, I can add a lock on my side like:
and
but I would like to avoid having full generators lookup (with fetching creds in some cases) under lock. Does anyone have suggestions? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@DmitryLukyanov |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
@DmitryLukyanov
FallbackCredentialsFactory.GetCredentials()
would always go through all generators and return the first fetched credentials. I'm unsure what's your use case to avoid having full generator lookup under lock. Could you please elaborate?