Description
I am currently running this on a long standing server that caches the client instance for the lifetime of the application.
Every once and a while, there is a flaky 401 that comes back from the client, subsequent runs work perfectly fine.
After reading through the client code, it looks like it may be a race condition with the expiry of the github token cache and then making the api call?
https://github.com/yanyongyu/githubkit/blob/master/githubkit/auth/app.py#L208 will check to see if the key is in the cache, so if its expired, it will fetch a new one perfectly fine. But what happens if the cache is there, but then the token expires within milliseconds of it attaching it to the api call. I believe that's what is leading to the 401 in these cases.
If you do believe that is the issue, I can certainly open up a PR to add some sort of buffer to the cache expiry to refresh the token x seconds (whatever we think is best) before it actually expires.
Happy to provide any other details/findings.
The exception is
RequestFailed
Response(401 Unauthorized, data_model=typing.Any)