From 76fdfc6f48b62f4bac0dd8f81621435926d7254a Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Sun, 5 Nov 2023 17:12:28 +0000 Subject: [PATCH] Cache UK bank holidays for six hours --- agenda/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agenda/__init__.py b/agenda/__init__.py index ad0cf1e..13f890e 100644 --- a/agenda/__init__.py +++ b/agenda/__init__.py @@ -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)