Skip to content

Commit f4e3c90

Browse files
committed
cleanup p-limit function
1 parent 70e3311 commit f4e3c90

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/transfer-manager.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -649,17 +649,14 @@ export class TransferManager {
649649
let chunkEnd = start + chunkSize - 1;
650650
chunkEnd = chunkEnd > size ? size : chunkEnd;
651651
promises.push(
652-
limit(() =>
653-
file
654-
.download({
655-
start: chunkStart,
656-
end: chunkEnd,
657-
[GCCL_GCS_CMD_KEY]: GCCL_GCS_CMD_FEATURE.DOWNLOAD_SHARDED,
658-
})
659-
.then(resp => {
660-
return fileToWrite.write(resp[0], 0, resp[0].length, chunkStart);
661-
})
662-
)
652+
limit(async () => {
653+
const resp = await file.download({
654+
start: chunkStart,
655+
end: chunkEnd,
656+
[GCCL_GCS_CMD_KEY]: GCCL_GCS_CMD_FEATURE.DOWNLOAD_SHARDED,
657+
});
658+
return fileToWrite.write(resp[0], 0, resp[0].length, chunkStart);
659+
})
663660
);
664661

665662
start += chunkSize;

0 commit comments

Comments
 (0)