[CLOUD-255] Cache GitHub App installation access token in external service config
Created by: unknwon
It is recommended to review without whitespaces.
GitHub App installation access token has a fixed expiry time of one hour. Previously, a new GitHub App installation access token is created on every single time we need to make an API call to the GitHub, that is super wasteful.
This PR implements caching GitHub App installation access token to the database and renew it automatically on-demand if the token has expired or about to expire in 5 minutes. In specific, the GitHub App installation access token is continue to be stored at the token
field of external_services.config
, and a new external_services.token_expires_at
column is created for storing the expiry time. Please refer to CLOUD-255 for more detailed rationale about the design.
Test plan
Local manual e2e tests following local test guide and unit tests.
Jira: CLOUD-255