chore: code cleanup
This commit is contained in:
parent
e0924f9c4b
commit
7416c6d441
|
|
@ -427,19 +427,12 @@ export class MinioStorageService implements StorageService {
|
|||
|
||||
const files: FileMetadata[] = [];
|
||||
|
||||
console.log(`[MinIO listFiles] Starting list for prefix: ${searchPrefix}`);
|
||||
const startTime = Date.now();
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const stream = this.client.listObjects(this.bucketName, searchPrefix, true);
|
||||
|
||||
let dataCount = 0;
|
||||
|
||||
stream.on('data', (obj) => {
|
||||
if (!obj.name || !obj.size) return;
|
||||
|
||||
dataCount++;
|
||||
|
||||
try {
|
||||
const pathParts = obj.name.split('/');
|
||||
const filename = pathParts[pathParts.length - 1];
|
||||
|
|
@ -472,16 +465,11 @@ export class MinioStorageService implements StorageService {
|
|||
});
|
||||
|
||||
stream.on('end', () => {
|
||||
const elapsed = Date.now() - startTime;
|
||||
console.log(
|
||||
`[MinIO listFiles] Stream ended. Processed ${dataCount} objects, collected ${files.length} files in ${elapsed}ms`,
|
||||
);
|
||||
resolve(files);
|
||||
});
|
||||
|
||||
stream.on('error', (error) => {
|
||||
const elapsed = Date.now() - startTime;
|
||||
console.error(`[MinIO listFiles] Stream error after ${elapsed}ms:`, error);
|
||||
console.error('[MinIO listFiles] Stream error:', error);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue