The _refresh_in_progress flag provides basic protection against concurrent refresh attempts but is not thread-safe. If multiple async tasks call _api_wrapper simultaneously with auth errors, they could all pass the check before any sets the flag to True, leading to multiple concurrent refresh attempts. Consider using asyncio.Lock instead of a boolean flag.
Originally posted by @Copilot in #6 (comment)
The
_refresh_in_progressflag provides basic protection against concurrent refresh attempts but is not thread-safe. If multiple async tasks call_api_wrappersimultaneously with auth errors, they could all pass the check before any sets the flag to True, leading to multiple concurrent refresh attempts. Consider usingasyncio.Lockinstead of a boolean flag.Originally posted by @Copilot in #6 (comment)