agenda: added retry on error

This commit is contained in:
Tigor Hutasuhut 2024-11-23 18:41:28 +07:00
parent b23a7a87c3
commit 0f91ff34ab

View file

@ -1,5 +1,5 @@
import { App, Astal, Gdk } from "astal/gtk3"; import { App, Astal, Gdk } from "astal/gtk3";
import { bind, execAsync, interval, Variable } from "astal"; import { bind, execAsync, interval, timeout, Variable } from "astal";
type AgendaItem = { type AgendaItem = {
startDate: string; startDate: string;
@ -65,6 +65,10 @@ export default function Agenda(gdkmonitor: Gdk.Monitor) {
transform(stdout), transform(stdout),
]); ]);
}; };
agenda.onError((err) => {
console.error(`failed to fetch agenda: ${err}`);
timeout(5000, watch);
});
const intervalHandler = interval(1000 * 60 * 10 /* 10 minutes */, watch); const intervalHandler = interval(1000 * 60 * 10 /* 10 minutes */, watch);
return ( return (
<window <window