Skip to content

Commit 8a2f600

Browse files
committed
increase timeout to 60 minutes
1 parent e830b7b commit 8a2f600

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/hooks/custom/SplitPdfHook.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ export class SplitPdfHook
164164
splitSize,
165165
)
166166

167+
const oneSecond = 1000;
168+
const oneMinute = 1000 * 60;
169+
const sixtyMinutes = oneMinute * 60;
170+
167171
const headers = prepareRequestHeaders(request);
168172

169173
const requests: Request[] = [];
@@ -185,11 +189,10 @@ export class SplitPdfHook
185189
file.name,
186190
firstPageNumber
187191
);
188-
const timeoutInMs = 60 * 10 * 1000;
189192
const req = new Request(requestClone, {
190193
headers,
191194
body,
192-
signal: AbortSignal.timeout(timeoutInMs)
195+
signal: AbortSignal.timeout(sixtyMinutes)
193196
});
194197
requests.push(req);
195198
setIndex+=1;
@@ -203,15 +206,14 @@ export class SplitPdfHook
203206
// These are the retry values from our api spec
204207
// We need to hardcode them here until we're able to reuse the SDK
205208
// from within this hook
206-
const oneSecond = 1000;
207-
const oneMinute = 1000 * 60;
209+
208210
const retryConfig = {
209211
strategy: "backoff",
210212
backoff: {
211213
initialInterval: oneSecond * 3,
212214
maxInterval: oneMinute * 12,
213215
exponent: 1.88,
214-
maxElapsedTime: oneMinute * 30,
216+
maxElapsedTime: sixtyMinutes,
215217
},
216218
} as RetryConfig;
217219

@@ -223,7 +225,8 @@ export class SplitPdfHook
223225
try {
224226
const response = await retry(
225227
async () => {
226-
return await this.client!.request(req.clone());
228+
const clone = req.clone();
229+
return await this.client!.request(clone);
227230
},
228231
{ config: retryConfig, statusCodes: retryCodes }
229232
);

0 commit comments

Comments
 (0)