codecov / engineering-team

This is a general repo to use with GH Projects
1 stars 1 forks source link

Resolve GitHub `access_tokens` on-demand #2356

Open Swatinem opened 2 months ago

Swatinem commented 2 months ago

As is visible in this trace, there is a POST to https://api.github.com/app/installations/XYZ/access_tokens, even though no other call out to GitHub is happening within that trace.

In such a case, the access token should not be resolved. It should only be resolved when it is needed for subsequent calls to the GitHub API, like in this trace

Swatinem commented 1 month ago

Apart from making the token resolution on-demand, I am also wondering whether the cache we have in place for those tokens is actually effective.

I have seen multiple traces where multiple calls to get_repo_provider_service in one task (deduplicating these is a separate issue) re-resolve the access token in every call, instead of making use of a cache.