Use cache for space launch data

This commit is contained in:
Edward Betts 2024-01-19 19:53:21 +00:00
parent 98b7c4a89d
commit e475f98dd6
3 changed files with 16 additions and 4 deletions

View file

@ -274,10 +274,10 @@ async def get_data(
result_list = await asyncio.gather(
time_function("gbpusd", fx.get_gbpusd, config),
time_function("gwr_advance_tickets", gwr.advance_ticket_date, data_dir),
time_function("rockets", thespacedevs.get_launches, rocket_dir, limit=40),
time_function("backwell_bins", waste_collection_events, data_dir),
time_function("bristol_bins", bristol_waste_collection_events, data_dir, today),
)
rockets = thespacedevs.read_cached_launches(rocket_dir)
results = {call[0]: call[1] for call in result_list}
@ -293,7 +293,7 @@ async def get_data(
"now": now,
"gbpusd": results["gbpusd"],
"stock_markets": stock_market_times,
"rockets": results["rockets"],
"rockets": rockets,
"gwr_advance_tickets": gwr_advance_tickets,
"data_gather_seconds": data_gather_seconds,
"stock_market_times_seconds": stock_market_times_seconds,
@ -350,7 +350,7 @@ async def get_data(
for market in overlapping_markets:
events.remove(market)
for launch in results["rockets"]:
for launch in rockets:
dt = None
if launch["net_precision"] == "Day":