@@ -7,7 +7,7 @@ import log from '@apify/log';
7
7
8
8
import type { ApifyApiError } from '../apify_api_error' ;
9
9
import type { ApiClientSubResourceOptions } from '../base/api_client' ;
10
- import { ResourceClient } from '../base/resource_client' ;
10
+ import { MEDIUM_TIMEOUT_MILLIS , ResourceClient , SMALL_TIMEOUT_MILLIS } from '../base/resource_client' ;
11
11
import type { ApifyRequestConfig } from '../http_client' ;
12
12
import {
13
13
cast ,
@@ -46,7 +46,7 @@ export class RequestQueueClient extends ResourceClient {
46
46
* https://docs.apify.com/api/v2#/reference/request-queues/queue/get-request-queue
47
47
*/
48
48
async get ( ) : Promise < RequestQueue | undefined > {
49
- return this . _get ( ) ;
49
+ return this . _get ( { } , SMALL_TIMEOUT_MILLIS ) ;
50
50
}
51
51
52
52
/**
@@ -55,14 +55,14 @@ export class RequestQueueClient extends ResourceClient {
55
55
async update ( newFields : RequestQueueClientUpdateOptions ) : Promise < RequestQueue > {
56
56
ow ( newFields , ow . object ) ;
57
57
58
- return this . _update ( newFields ) ;
58
+ return this . _update ( newFields , SMALL_TIMEOUT_MILLIS ) ;
59
59
}
60
60
61
61
/**
62
62
* https://docs.apify.com/api/v2#/reference/request-queues/queue/delete-request-queue
63
63
*/
64
64
async delete ( ) : Promise < void > {
65
- return this . _delete ( ) ;
65
+ return this . _delete ( SMALL_TIMEOUT_MILLIS ) ;
66
66
}
67
67
68
68
/**
@@ -79,7 +79,7 @@ export class RequestQueueClient extends ResourceClient {
79
79
const response = await this . httpClient . call ( {
80
80
url : this . _url ( 'head' ) ,
81
81
method : 'GET' ,
82
- timeout : this . timeoutMillis ,
82
+ timeout : Math . min ( SMALL_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
83
83
params : this . _params ( {
84
84
limit : options . limit ,
85
85
clientKey : this . clientKey ,
@@ -106,7 +106,7 @@ export class RequestQueueClient extends ResourceClient {
106
106
const response = await this . httpClient . call ( {
107
107
url : this . _url ( 'head/lock' ) ,
108
108
method : 'POST' ,
109
- timeout : this . timeoutMillis ,
109
+ timeout : Math . min ( MEDIUM_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
110
110
params : this . _params ( {
111
111
limit : options . limit ,
112
112
lockSecs : options . lockSecs ,
@@ -141,7 +141,7 @@ export class RequestQueueClient extends ResourceClient {
141
141
const response = await this . httpClient . call ( {
142
142
url : this . _url ( 'requests' ) ,
143
143
method : 'POST' ,
144
- timeout : this . timeoutMillis ,
144
+ timeout : Math . min ( SMALL_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
145
145
data : request ,
146
146
params : this . _params ( {
147
147
forefront : options . forefront ,
@@ -182,7 +182,7 @@ export class RequestQueueClient extends ResourceClient {
182
182
const { data } = await this . httpClient . call ( {
183
183
url : this . _url ( 'requests/batch' ) ,
184
184
method : 'POST' ,
185
- timeout : this . timeoutMillis ,
185
+ timeout : Math . min ( MEDIUM_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
186
186
data : requests ,
187
187
params : this . _params ( {
188
188
forefront : options . forefront ,
@@ -343,7 +343,7 @@ export class RequestQueueClient extends ResourceClient {
343
343
const { data } = await this . httpClient . call ( {
344
344
url : this . _url ( 'requests/batch' ) ,
345
345
method : 'DELETE' ,
346
- timeout : this . timeoutMillis ,
346
+ timeout : Math . min ( SMALL_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
347
347
data : requests ,
348
348
params : this . _params ( {
349
349
clientKey : this . clientKey ,
@@ -361,7 +361,7 @@ export class RequestQueueClient extends ResourceClient {
361
361
const requestOpts : ApifyRequestConfig = {
362
362
url : this . _url ( `requests/${ id } ` ) ,
363
363
method : 'GET' ,
364
- timeout : this . timeoutMillis ,
364
+ timeout : Math . min ( SMALL_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
365
365
params : this . _params ( ) ,
366
366
} ;
367
367
try {
@@ -398,7 +398,7 @@ export class RequestQueueClient extends ResourceClient {
398
398
const response = await this . httpClient . call ( {
399
399
url : this . _url ( `requests/${ request . id } ` ) ,
400
400
method : 'PUT' ,
401
- timeout : this . timeoutMillis ,
401
+ timeout : Math . min ( MEDIUM_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
402
402
data : request ,
403
403
params : this . _params ( {
404
404
forefront : options . forefront ,
@@ -415,7 +415,7 @@ export class RequestQueueClient extends ResourceClient {
415
415
await this . httpClient . call ( {
416
416
url : this . _url ( `requests/${ id } ` ) ,
417
417
method : 'DELETE' ,
418
- timeout : this . timeoutMillis ,
418
+ timeout : Math . min ( SMALL_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
419
419
params : this . _params ( {
420
420
clientKey : this . clientKey ,
421
421
} ) ,
@@ -441,7 +441,7 @@ export class RequestQueueClient extends ResourceClient {
441
441
const response = await this . httpClient . call ( {
442
442
url : this . _url ( `requests/${ id } /lock` ) ,
443
443
method : 'PUT' ,
444
- timeout : this . timeoutMillis ,
444
+ timeout : Math . min ( MEDIUM_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
445
445
params : this . _params ( {
446
446
forefront : options . forefront ,
447
447
lockSecs : options . lockSecs ,
@@ -467,7 +467,7 @@ export class RequestQueueClient extends ResourceClient {
467
467
await this . httpClient . call ( {
468
468
url : this . _url ( `requests/${ id } /lock` ) ,
469
469
method : 'DELETE' ,
470
- timeout : this . timeoutMillis ,
470
+ timeout : Math . min ( SMALL_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
471
471
params : this . _params ( {
472
472
forefront : options . forefront ,
473
473
clientKey : this . clientKey ,
@@ -492,7 +492,7 @@ export class RequestQueueClient extends ResourceClient {
492
492
const response = await this . httpClient . call ( {
493
493
url : this . _url ( 'requests' ) ,
494
494
method : 'GET' ,
495
- timeout : this . timeoutMillis ,
495
+ timeout : Math . min ( MEDIUM_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
496
496
params : this . _params ( {
497
497
limit : options . limit ,
498
498
exclusiveStartId : options . exclusiveStartId ,
@@ -510,7 +510,7 @@ export class RequestQueueClient extends ResourceClient {
510
510
const response = await this . httpClient . call ( {
511
511
url : this . _url ( 'requests/unlock' ) ,
512
512
method : 'POST' ,
513
- timeout : this . timeoutMillis ,
513
+ timeout : Math . min ( MEDIUM_TIMEOUT_MILLIS , this . timeoutMillis ?? Infinity ) ,
514
514
params : this . _params ( {
515
515
clientKey : this . clientKey ,
516
516
} ) ,
0 commit comments