Skip to content
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

Cache response from yr.no #355

Closed
Erb3 opened this issue Nov 6, 2023 · 0 comments · Fixed by #358
Closed

Cache response from yr.no #355

Erb3 opened this issue Nov 6, 2023 · 0 comments · Fixed by #358
Labels
enhancement New feature or request

Comments

@Erb3
Copy link
Contributor

Erb3 commented Nov 6, 2023

Added in #354, the weather source is yr.no. Yr requires that the responses from their API are cached. We should narrow down the coordinates to a bigger area, then cache it in Redis for a few hours. Redis supports expiry of values, which is nice.

I've separated it into smaller tasks:

  • Make redis available to weather.ts route
  • Make sure redis is still available to middleware.ts
  • Remove a few decimals from the coordinates for them to be less accurate and cover a bigger area
  • Store the coordinates and summary, max_temp and min_temp in redis. Expire after a few hours.
  • On request to weather API, check if we have a cached version of the response, if so return that
  • Document this

To be clear, I am not suggesting that all of these changes have their own PR, all of them should be in one PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant