KI-AGENT: Mandantenbezogenen IMAP-Dokumentenimport umsetzen

This commit is contained in:
2026-08-07 21:07:05 +02:00
parent 75d7bfab38
commit 519a90bdc1
10 changed files with 823 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import { FastifyInstance } from "fastify"
const SYNC_INTERVAL_MS = 5 * 60 * 1000
export function startDocumentImportWorker(server: FastifyInstance) {
const run = () => server.services.documentImports.syncAll().catch((error) => {
server.log.error({ error }, "Automatischer Dokumentenimport fehlgeschlagen")
})
const timer = setInterval(run, SYNC_INTERVAL_MS)
timer.unref()
server.addHook("onClose", async () => clearInterval(timer))
}