Aktualisiere die Version auf 1.4.3, füge Validierung für Saison-Slugs hinzu und implementiere ein Logging-System für Fehler und Informationen
Some checks failed
Code Analysis and Production Deploy / analyze (push) Has been skipped
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 1m49s
Code Analysis and Production Deploy / analyze (pull_request) Failing after 2m37s
Code Analysis and Production Deploy / deploy-production (pull_request) Has been skipped
Code Analysis and Production Deploy / deploy-test (pull_request) Has been skipped
Require Package Version Change / check (pull_request) Failing after 8s

This commit is contained in:
Torsten Schulz (local)
2026-05-20 11:20:54 +02:00
parent 2503eb92af
commit e5c247f703
7 changed files with 73 additions and 20 deletions

View File

@@ -1,4 +1,5 @@
import { importSpielplan } from '../utils/spielplan-import.js'
import { info as loggerInfo, error as loggerError } from '../utils/logger.js'
const TIME_ZONE = 'Europe/Berlin'
const RUN_HOUR = 7
@@ -68,9 +69,9 @@ async function runImport(reason) {
running = true
try {
const result = await importSpielplan()
console.log(`[spielplan-import] ${reason}: ${result.matchCount} Spiele importiert (${result.source.season.dateStart} bis ${result.source.season.dateEnd})`)
loggerInfo(`[spielplan-import] ${reason}: ${result.matchCount} Spiele importiert`, { range: `${result.source.season.dateStart} - ${result.source.season.dateEnd}` })
} catch (error) {
console.error('[spielplan-import] Import fehlgeschlagen:', error)
loggerError('[spielplan-import] Import fehlgeschlagen:', { error })
} finally {
running = false
}
@@ -86,12 +87,12 @@ function scheduleNext() {
}, delay)
timer.unref?.()
console.log(`[spielplan-import] Naechster Lauf: ${runAt.toISOString()} (${TIME_ZONE} ${String(RUN_HOUR).padStart(2, '0')}:${String(RUN_MINUTE).padStart(2, '0')})`)
loggerInfo('[spielplan-import] Naechster Lauf', { runAt: runAt.toISOString(), tz: TIME_ZONE, time: `${String(RUN_HOUR).padStart(2, '0')}:${String(RUN_MINUTE).padStart(2, '0')}` })
}
export default defineNitroPlugin((nitroApp) => {
if (process.env.SPIELPLAN_IMPORT_DISABLED === 'true') {
console.log('[spielplan-import] Scheduler deaktiviert')
loggerInfo('[spielplan-import] Scheduler deaktiviert')
return
}