Respect SpaceDevs request limits and cooldowns
This commit is contained in:
parent
69992bebb7
commit
3f6ee4f2ec
3 changed files with 124 additions and 13 deletions
12
update.py
12
update.py
|
|
@ -342,10 +342,6 @@ def update_thespacedevs(config: flask.config.Config) -> None:
|
|||
if agenda.thespacedevs.is_launches_cache_fresh(rocket_dir):
|
||||
return
|
||||
|
||||
# Update active crewed mission cache used by the launches page.
|
||||
# Uses the 2-hour TTL; failures are handled internally with cache fallback.
|
||||
active_crewed = agenda.thespacedevs.get_active_crewed_flights(rocket_dir)
|
||||
|
||||
# Always follow configured slugs
|
||||
follow_slugs: set[str] = set(config["FOLLOW_LAUNCHES"])
|
||||
|
||||
|
|
@ -357,7 +353,10 @@ def update_thespacedevs(config: flask.config.Config) -> None:
|
|||
}
|
||||
|
||||
t0 = time()
|
||||
data = agenda.thespacedevs.next_launch_api_data(rocket_dir)
|
||||
try:
|
||||
data = agenda.thespacedevs.next_launch_api_data(rocket_dir)
|
||||
except agenda.thespacedevs.RateLimitDeferred:
|
||||
return
|
||||
if not data:
|
||||
send_thespacedevs_payload_alert(
|
||||
config,
|
||||
|
|
@ -375,6 +374,9 @@ def update_thespacedevs(config: flask.config.Config) -> None:
|
|||
)
|
||||
return
|
||||
|
||||
# Fetch upcoming launches first so historical pagination cannot starve them.
|
||||
active_crewed = agenda.thespacedevs.get_active_crewed_flights(rocket_dir)
|
||||
|
||||
# Identify test-flight slugs present in the current data
|
||||
cur_test_slugs: set[str] = {
|
||||
typing.cast(str, item["slug"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue