fix(v2): await handleRecurrence so the DB isn't closed mid-flight
sweepSession called handleRecurrence without await, then synchronously
closed inDb in its finally block. handleRecurrence is async because it
does a dynamic `import('cron-parser')` before the first DB write; that
import resolved after the finally had already run, so insertRecurrence
hit a closed handle and threw "The database connection is not open".
Net effect: every recurring task was correctly marked completed by
syncProcessingAcks, but its next occurrence never got scheduled.
Single-word fix — `await`.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -101,7 +101,7 @@ async function sweepSession(session: Session): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. Handle recurrence for completed messages
|
// 4. Handle recurrence for completed messages
|
||||||
handleRecurrence(inDb, session);
|
await handleRecurrence(inDb, session);
|
||||||
} finally {
|
} finally {
|
||||||
inDb.close();
|
inDb.close();
|
||||||
outDb?.close();
|
outDb?.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user