pynws icon indicating copy to clipboard operation
pynws copied to clipboard

Add more conditions for retries

Open MatthewFlamm opened this issue 1 year ago • 3 comments

It might be useful to have other conditions kick off retry attempts, e.g.

  • [x] blank observations (e.g. [] returned)
  • [x] blank forecasts being returned (see above)
  • [ ] outdated observations being returned
  • [x] outdated forecasts being returned
  • [ ] detailed Forecasts
  • [ ] all alerts updates. (Not useful?)

MatthewFlamm avatar May 02 '24 19:05 MatthewFlamm

A problem with the current use of call_with_retry that wraps any update_* call is that is is harder to make special cases for update_observation for example.

MatthewFlamm avatar May 03 '24 21:05 MatthewFlamm

One thought that I like is to have a new keyword arg for each update_* method that would raise an error when some condition is met for the data coming back from the update. We could use NWSError or subclass from it.

This would allow us to catch those specific errors in the retry, it also allows downstream codes to catch them.

MatthewFlamm avatar May 03 '24 21:05 MatthewFlamm

Observations already allow a start_time parameter, right now we trust NWS to satisfy this request. We should also filter it if user supplies this and NWS returns old data.

MatthewFlamm avatar May 08 '24 09:05 MatthewFlamm