forked from HENNGE/aiodynamo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix timing bug in Refreshable, optimize ChainCredentials
Refreshable had a timing bug where refreshing the token could result in an invalid state if invalidate() was called at the same time. This is due to the Event Loop being able to schedule other coroutines to run between the current value being set in _refresh() and the value being checked in get(). By moving the assignment from _refresh() to get(), no other coroutines can run between the setting and checking, preventing the class from ending up in an invalid state. ChainCredentials would needlessly check many candidates every time, even if it had already done so previously. Since running code cannot move to different environments, this check is unneccessary and inefficient, so instead ChainCredentials now remembers when a provider has succeeded and will only try that one again.
- Loading branch information
Showing
5 changed files
with
110 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters