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