Update sftp.service.ts

This commit is contained in:
Baobhan Sith
2025-05-15 19:28:53 +08:00
parent 4ed9d30f92
commit b9d1a70b9a
@@ -1574,24 +1574,6 @@ export class SftpService {
}
});
if (!writeSuccess) {
console.warn(`[SFTP Upload ${uploadId}] Write stream buffer full after chunk ${chunkIndex}. Waiting for drain is recommended for large files/slow connections.`);
}
if (!writeSuccess) {
// console.warn(`[SFTP Upload ${uploadId}] Write stream buffer full after chunk ${chunkIndex}. Pausing chunk processing until 'drain'.`);
try {
await new Promise<void>(resolve => uploadState.stream.once('drain', resolve));
// console.log(`[SFTP Upload ${uploadId}] Write stream drained after chunk ${chunkIndex}. Resuming chunk processing.`);
} catch (drainError) {
// Should not happen with .once, but handle defensively
console.error(`[SFTP Upload ${uploadId}] Error waiting for drain event:`, drainError);
// Consider cancelling upload if waiting for drain fails critically
this.cancelUploadInternal(uploadId, 'Error waiting for drain');
throw drainError; // Re-throw to stop further processing in this chunk handler
}
}
if (!writeSuccess) {