Cache UK bank holidays for six hours

This commit is contained in:
Edward Betts 2023-11-05 17:12:28 +00:00
parent 4f2b9f7fae
commit 76fdfc6f48

View file

@ -120,7 +120,7 @@ async def get_next_bank_holiday(input_date: date) -> list[Event]:
url = "https://www.gov.uk/bank-holidays.json"
filename = os.path.join(data_dir, "bank-holidays.json")
mtime = os.path.getmtime(filename)
if (unixtime() - mtime) > 3600: # one hour
if (unixtime() - mtime) > 60 * 60 * 6: # six hours
async with httpx.AsyncClient() as client:
r = await client.get(url)
open(filename, "w").write(r.text)