@@ 20,8 20,8 @@ if not path or path == "/":
posts = None
if cache:
- date = datetime.fromtimestamp(cache["date"])
- if date < datetime.now() - timedelta(seconds=300):
+ expiry = datetime.fromtimestamp(cache["expiry"])
+ if datetime.now() < expiry:
posts = cache["posts"]
if not posts:
@@ 34,7 34,7 @@ if not path or path == "/":
with open("/tmp/post-cache.json", "w") as f:
f.write(json.dumps({
"posts": posts,
- "date": datetime.timestamp(datetime.now()),
+ "expiry": datetime.timestamp(datetime.now() + timedelta(seconds=300)),
}))
sys.stdout.write("20 text/gemini\r\n")