-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite and address random 404s #23
Conversation
Hey @Naramsim. I can, however, comment on your analysis.
We should probably look into why these timeouts are happening. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me based on my familiarity with Firebase.
.circleci/config.yml
Outdated
- checkout | ||
- run: yarn --ignore-engines --cwd functions | ||
# TODO: write some tests and run them here | ||
# test: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just drop this?
@Kronopt we need to cache calls for non-existent objects. For example, the call to https://pokeapi.co/api/v2/pokemon/cat is a valid call and should return a 404. About the timeouts, I struggle to find a reason. It's just my bet that that's the problem causing the Also, the code didn't seem to contain any loops or deadlocks, so I don't think it's a problem with the code itself. I also remember that this issue manifested itself at a certain random point in time, not after a specific change in the code. |
I'll merge this then. I'll keep an eye on the logs and if needed I'll roll back. |
Quick update, since yesterday (12h ago) we returned 10 |
This PR:
engine
field of ourpackage.json
404
for 1h instead of 24hSo, during my analysis, I think I found out why we have random
404
errors. Looking at the logs of our cloud function it happens that now and then the function times out (10s) and thus, I think, Cloudflare caches the empty response. So I came up with a solution that handles timeout problems with a retry logic. A response will always be returned by the function in max 8+8 seconds.External changes:
Cache Everything
feature of Cloudflare, since we already have Cloudflare Cache TTL set to respect headers. In this way, I hope we will cache our200
s for 1d, our404
s for 1h, while possible other errors (504
) will not be cached and thus retried in the future by someone else without serving cached504
s.https://staging.pokeapi.co/api/v2/