Whenever Codeforces contests are live, their API gets slow, and as a result, my API gives FUNCTION_INVOCATION_TIMEOUT error because of the Vercel limits.
One solution to that can be a custom API cache adapter at the backend to cache codeforces API that saves the last 200 response data separately along with a time limit for temporary cache. So when data is not found in the temporary cache, it calls API, and if API gives an error or takes more than some seconds, it returns the last 200 response data.
Whenever Codeforces contests are live, their API gets slow, and as a result, my API gives
FUNCTION_INVOCATION_TIMEOUT
error because of the Vercel limits.One solution to that can be a custom API cache adapter at the backend to cache codeforces API that saves the last 200 response data separately along with a time limit for temporary cache. So when data is not found in the temporary cache, it calls API, and if API gives an error or takes more than some seconds, it returns the last 200 response data.