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
Build and Push Multi-Platform Images / build-and-push (push) Successful in 34s
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user