|
1 | 1 | import async from "async"; |
| 2 | +import { v4 as uuidv4 } from 'uuid'; |
2 | 3 |
|
3 | 4 | import { |
4 | 5 | AfterErrorContext, |
@@ -96,7 +97,8 @@ export class SplitPdfHook |
96 | 97 | hookCtx: BeforeRequestContext, |
97 | 98 | request: Request |
98 | 99 | ): Promise<Request> { |
99 | | - const { operationID } = hookCtx; |
| 100 | + const operationID = uuidv4(); |
| 101 | + hookCtx.operationID = operationID; |
100 | 102 | const requestClone = request.clone(); |
101 | 103 | const formData = await requestClone.formData(); |
102 | 104 | const splitPdfPage = stringToBoolean( |
@@ -331,7 +333,8 @@ export class SplitPdfHook |
331 | 333 | hookCtx: AfterSuccessContext, |
332 | 334 | response: Response |
333 | 335 | ): Promise<Response> { |
334 | | - const { operationID } = hookCtx; |
| 336 | + const operationID = uuidv4(); |
| 337 | + hookCtx.operationID = operationID; |
335 | 338 | const responses = await this.awaitAllRequests(operationID); |
336 | 339 | const successfulResponses = responses?.get("success") ?? []; |
337 | 340 | const failedResponses = responses?.get("failed") ?? []; |
@@ -362,7 +365,8 @@ export class SplitPdfHook |
362 | 365 | response: Response | null, |
363 | 366 | error: unknown |
364 | 367 | ): Promise<{ response: Response | null; error: unknown }> { |
365 | | - const { operationID } = hookCtx; |
| 368 | + const operationID = uuidv4(); |
| 369 | + hookCtx.operationID = operationID; |
366 | 370 | const responses = await this.awaitAllRequests(operationID); |
367 | 371 | const successfulResponses = responses?.get("success") ?? []; |
368 | 372 | const failedResponses = responses?.get("failed") ?? []; |
|
0 commit comments