Skip to content

Commit 6668474

Browse files
committed
update operationID to be uuid
1 parent fdf6787 commit 6668474

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/hooks/custom/SplitPdfHook.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import async from "async";
2+
import { v4 as uuidv4 } from 'uuid';
23

34
import {
45
AfterErrorContext,
@@ -96,7 +97,8 @@ export class SplitPdfHook
9697
hookCtx: BeforeRequestContext,
9798
request: Request
9899
): Promise<Request> {
99-
const { operationID } = hookCtx;
100+
const operationID = uuidv4();
101+
hookCtx.operationID = operationID;
100102
const requestClone = request.clone();
101103
const formData = await requestClone.formData();
102104
const splitPdfPage = stringToBoolean(
@@ -331,7 +333,8 @@ export class SplitPdfHook
331333
hookCtx: AfterSuccessContext,
332334
response: Response
333335
): Promise<Response> {
334-
const { operationID } = hookCtx;
336+
const operationID = uuidv4();
337+
hookCtx.operationID = operationID;
335338
const responses = await this.awaitAllRequests(operationID);
336339
const successfulResponses = responses?.get("success") ?? [];
337340
const failedResponses = responses?.get("failed") ?? [];
@@ -362,7 +365,8 @@ export class SplitPdfHook
362365
response: Response | null,
363366
error: unknown
364367
): Promise<{ response: Response | null; error: unknown }> {
365-
const { operationID } = hookCtx;
368+
const operationID = uuidv4();
369+
hookCtx.operationID = operationID;
366370
const responses = await this.awaitAllRequests(operationID);
367371
const successfulResponses = responses?.get("success") ?? [];
368372
const failedResponses = responses?.get("failed") ?? [];

0 commit comments

Comments
 (0)