alexander0042 / alexander0042.github.io

Public Website for Pirate Weather API
7 stars 1 forks source link

Getting 502 Bad Gateway on /forecast #2

Closed adamgauthier closed 3 years ago

adamgauthier commented 3 years ago

I created an account and subscribed to "PirateForcast". I'm getting this error when attempting to use the API:

$ curl --request GET --url 'https://api.pirateweather.net/forecast/{MY-API-KEY}/10.2048493,-80.2707828'
{"message": "Internal server error"}
alexander0042 commented 3 years ago

Hi, Thanks for opening this! I noticed a number of errors in the logs due to an edge(ish) case when it was a mostly clear night with a chance of rain, and I think I've addressed it in the latest version! Can you let me know if you're still seeing this error now?

adamgauthier commented 3 years ago

Hey Alexander, the problem seems to be fixed now, thank you! As a side note, it's not a big deal, but the API seems to take about ~1500ms to respond compared to ~100ms for DarkSky. They're a company though, so they have much more budget to optimize their service.

alexander0042 commented 3 years ago

The retrieval time has been the eternal limiting factor for this project- my original plan of using GRIB files directly on S3 was an order of magnitude simpler, but took 10 seconds to get the results.

I pushed a small change last night that added interpolation between grid cells to make results more accurate, but underestimated the additional latency that it would add. I'm updating it to only use this for GFS, instead of all the sources, which should improve things a little bit shortly