RedHeadphone / codeforces-readme-stats

⚡ Dynamically generated Codeforces stats for your Github profile!
https://codeforces-readme-stats.vercel.app
MIT License
45 stars 6 forks source link

FUNCTION_INVOCATION_TIMEOUT Error #6

Open RedHeadphone opened 1 year ago

RedHeadphone commented 1 year ago

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.

RedHeadphone commented 8 months ago

Possible way to implement it: https://stackoverflow.com/questions/56029972/return-for-function-after-certain-execution-time/56062464#56062464