fix: prevent processing of empty files in PDF service and scanner watcher
Build and Push Multi-Platform Images / build-and-push (push) Successful in 34s

This commit is contained in:
2026-05-04 16:35:20 +02:00
parent a9c17b45b3
commit 60ac522435
2 changed files with 18 additions and 1 deletions
@@ -143,7 +143,7 @@ export class ScannerWatcherService implements OnModuleInit, OnModuleDestroy {
private async isStable(filePath: string): Promise<boolean> {
try {
const stat = await fs.stat(filePath);
return Date.now() - stat.mtimeMs >= STABILITY_MS;
return stat.size > 0 && Date.now() - stat.mtimeMs >= STABILITY_MS;
} catch {
return false;
}
@@ -164,6 +164,17 @@ export class ScannerWatcherService implements OnModuleInit, OnModuleDestroy {
const fileName = parts[1];
if (this.processing.has(filePath)) return;
try {
const stat = await fs.stat(filePath);
if (stat.size === 0) {
this.logger.debug(`Überspringe leere Datei: ${filePath}`);
return;
}
} catch {
return;
}
this.processing.add(filePath);
try {