apify 4.0.0-beta.92 → 4.0.0-beta.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -45,7 +45,7 @@ export declare abstract class ApifyRequestQueueBackend implements RequestQueueBa
|
|
|
45
45
|
abstract reclaimRequest(request: UpdateRequestSchema, options?: RequestQueueOperationOptions): Promise<QueueOperationInfo | undefined>;
|
|
46
46
|
abstract isEmpty(): Promise<boolean>;
|
|
47
47
|
abstract isFinished(): Promise<boolean>;
|
|
48
|
-
|
|
48
|
+
setExpectedRequestProcessingTime(_processingTimeSecs: number): Promise<void>;
|
|
49
49
|
getMetadata(): Promise<RequestQueueInfo>;
|
|
50
50
|
drop(): Promise<void>;
|
|
51
51
|
purge(): Promise<void>;
|
|
@@ -32,7 +32,7 @@ export class ApifyRequestQueueBackend {
|
|
|
32
32
|
constructor(client) {
|
|
33
33
|
this.client = client;
|
|
34
34
|
}
|
|
35
|
-
async
|
|
35
|
+
async setExpectedRequestProcessingTime(_processingTimeSecs) {
|
|
36
36
|
// Only relevant for backends that reserve requests via locking; see the shared backend.
|
|
37
37
|
}
|
|
38
38
|
async getMetadata() {
|
|
@@ -7,14 +7,14 @@ import { ApifyRequestQueueBackend } from './apify_request_queue_backend.js';
|
|
|
7
7
|
* number of clients — including other Actor runs — can process the same queue concurrently without
|
|
8
8
|
* handing out a request twice. The lock is held until the request is marked as handled or
|
|
9
9
|
* reclaimed, and its duration follows the consumer's expected processing time
|
|
10
|
-
* (see {@link
|
|
10
|
+
* (see {@link setExpectedRequestProcessingTime}). This consistency costs roughly one extra API
|
|
11
11
|
* call per processed request compared to the single-consumer backend.
|
|
12
12
|
*
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export declare class ApifyRequestQueueSharedBackend extends ApifyRequestQueueBackend {
|
|
16
16
|
#private;
|
|
17
|
-
|
|
17
|
+
setExpectedRequestProcessingTime(processingTimeSecs: number): Promise<void>;
|
|
18
18
|
addBatchOfRequests(requests: RequestSchema[], options?: RequestQueueOperationOptions): Promise<BatchAddRequestsResult>;
|
|
19
19
|
getRequest(uniqueKey: string): Promise<UpdateRequestSchema | undefined>;
|
|
20
20
|
fetchNextRequest(): Promise<UpdateRequestSchema | undefined>;
|
|
@@ -14,7 +14,7 @@ const HEAD_LOCK_LIMIT = 25;
|
|
|
14
14
|
* number of clients — including other Actor runs — can process the same queue concurrently without
|
|
15
15
|
* handing out a request twice. The lock is held until the request is marked as handled or
|
|
16
16
|
* reclaimed, and its duration follows the consumer's expected processing time
|
|
17
|
-
* (see {@link
|
|
17
|
+
* (see {@link setExpectedRequestProcessingTime}). This consistency costs roughly one extra API
|
|
18
18
|
* call per processed request compared to the single-consumer backend.
|
|
19
19
|
*
|
|
20
20
|
* @internal
|
|
@@ -28,14 +28,14 @@ export class ApifyRequestQueueSharedBackend extends ApifyRequestQueueBackend {
|
|
|
28
28
|
#inProgressIds = new Set();
|
|
29
29
|
/** Whether the last head read reported any locked requests left in the queue (any client's). */
|
|
30
30
|
#queueHasLockedRequests;
|
|
31
|
-
/** Lock duration applied to fetched requests; raised via `
|
|
31
|
+
/** Lock duration applied to fetched requests; raised via `setExpectedRequestProcessingTime`. */
|
|
32
32
|
#lockSecs = DEFAULT_REQUEST_LOCK_SECS;
|
|
33
33
|
/** Serializes head reads and reclaims — both reorder the shared head state. */
|
|
34
34
|
#headLock = new AsyncLock();
|
|
35
|
-
async
|
|
35
|
+
async setExpectedRequestProcessingTime(processingTimeSecs) {
|
|
36
36
|
// Only ever raise the lock duration — several consumers may share this client, and a
|
|
37
37
|
// short-lived one must not cut the reservation of a long-running one short.
|
|
38
|
-
this.#lockSecs = Math.max(this.#lockSecs,
|
|
38
|
+
this.#lockSecs = Math.max(this.#lockSecs, processingTimeSecs);
|
|
39
39
|
}
|
|
40
40
|
async addBatchOfRequests(requests, options = {}) {
|
|
41
41
|
const { forefront = false } = options;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apify",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.93",
|
|
4
4
|
"description": "The scalable web crawling and scraping library for JavaScript/Node.js. Enables development of data extraction and web automation jobs (not only) with headless Chrome and Puppeteer.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.13.0"
|