astropy / astropy/astroquery

astroquery cache should fall back to expired cache if remote fails

Open
#2,909 1 comment 0 reactions 0 assignees View on GitHub
cache feature request
Dominant language
Python
Stars
791
Forks
451
Avg merge
1d 3h
Merged PRs (30d)
4

Description

Some API backends (like MPC) have extended downtimes, and there is currently not easy way to tell astroquery (post-0.4.6 / #1634) to fall back to an existing expired cached response if the request raises an exception, while still respecting the regular cache expiration for successful requests.
In [requests-cache](https://requests-cache.readthedocs.io/en/stable/user_guide/expiration.html#expiration-and-error-handling), the equivalent setting would be `stale_if_error=True`. Maybe switching to requests-cache would be a good improvement, since it would allow deep customization of caching behavior, like an offline mode with `only_if_cached=True`.

Contributor guide

Open the contributing guide

Research direction

Start by tracing astroquery's cache behavior introduced after 0.4.6 and the changes referenced in #1634; inspect how remote request exceptions and normal cache expiration are handled. Compare the requested stale-if-error behavior with requests-cache's expiration and error-handling options, then define done as using an expired response only when the remote request fails while preserving regular expiration for successful requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.