diff --git a/src/app/api/events/route.ts b/src/app/api/events/route.ts index 04dfe22..f6809d9 100644 --- a/src/app/api/events/route.ts +++ b/src/app/api/events/route.ts @@ -75,6 +75,15 @@ export async function GET(request: Request): Promise { const lastTouchedPath = path.join(projectRoot, '.beads', 'last-touched'); let lastTouchedVersion: number | null = null; + let isPolling = false; + const pollLastTouched = async () => { + if (isPolling) { + return; + } + isPolling = true; + try { + const nextVersion = await readLastTouchedVersion(lastTouchedPath); + if (nextVersion === null) { let isPolling = false; const pollLastTouched = async () => { if (isPolling) {