From 0f91ff34abd030b9a6b9e90dd50c97b40ea50a9a Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Sat, 23 Nov 2024 18:41:28 +0700 Subject: [PATCH] agenda: added retry on error --- widget/Agenda.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/widget/Agenda.tsx b/widget/Agenda.tsx index 04df321..9a2aac4 100644 --- a/widget/Agenda.tsx +++ b/widget/Agenda.tsx @@ -1,5 +1,5 @@ import { App, Astal, Gdk } from "astal/gtk3"; -import { bind, execAsync, interval, Variable } from "astal"; +import { bind, execAsync, interval, timeout, Variable } from "astal"; type AgendaItem = { startDate: string; @@ -65,6 +65,10 @@ export default function Agenda(gdkmonitor: Gdk.Monitor) { transform(stdout), ]); }; + agenda.onError((err) => { + console.error(`failed to fetch agenda: ${err}`); + timeout(5000, watch); + }); const intervalHandler = interval(1000 * 60 * 10 /* 10 minutes */, watch); return (