KI-AGENT: Mandantenbezogenen IMAP-Dokumentenimport umsetzen
This commit is contained in:
@@ -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))
|
||||
}
|
||||
Reference in New Issue
Block a user