Skip to content

Commit 2466b93

Browse files
CCM-9872: Parallelise s3 copy
1 parent 33cacb5 commit 2466b93

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

lambdas/backend-api/src/templates/api/process-proof.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,24 @@ export const createHandler =
3636
scanResultStatus === 'NO_THREATS_FOUND' ? 'PASSED' : 'FAILED';
3737

3838
if (virusScanResult === 'PASSED') {
39-
await letterFileRepository.copyFromQuarantineToInternal(
40-
objectKey,
41-
versionId,
42-
internalKey
43-
);
44-
4539
const downloadKey = LetterProofRepository.getDownloadKey(
4640
owner,
4741
templateId,
4842
fileName
4943
);
5044

51-
await letterFileRepository.copyFromQuarantineToDownload(
52-
objectKey,
53-
versionId,
54-
downloadKey
55-
);
45+
await Promise.all([
46+
letterFileRepository.copyFromQuarantineToInternal(
47+
objectKey,
48+
versionId,
49+
internalKey
50+
),
51+
letterFileRepository.copyFromQuarantineToDownload(
52+
objectKey,
53+
versionId,
54+
downloadKey
55+
),
56+
]);
5657
} else {
5758
logger.error({
5859
description: 'File found that did not pass virus scan',

0 commit comments

Comments
 (0)