@crawlee/basic 4.0.0-beta.193 → 4.0.0-beta.195
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.
|
@@ -659,6 +659,10 @@ export class BasicCrawler {
|
|
|
659
659
|
if (context[navigationDeadlineKey] !== undefined) {
|
|
660
660
|
context[navigationDeadlineKey] += extraMillis;
|
|
661
661
|
}
|
|
662
|
+
// Extension failure must not fail the request that asked for more time.
|
|
663
|
+
this.requestManager?.extendRequestProcessingTimeSecs?.(context.request, secs)?.catch((error) => {
|
|
664
|
+
this.log.debug('Extending the request processing time failed', { url: context.request.url, error });
|
|
665
|
+
});
|
|
662
666
|
},
|
|
663
667
|
};
|
|
664
668
|
}
|
|
@@ -186,8 +186,9 @@ export interface CrawlingContext<UserData extends Dictionary = Dictionary> exten
|
|
|
186
186
|
* ```
|
|
187
187
|
*
|
|
188
188
|
* Extends the request handler's own timeout and the crawler's internal one together, so the extension
|
|
189
|
-
* is not immediately undone by the latter.
|
|
190
|
-
*
|
|
189
|
+
* is not immediately undone by the latter. On a locking storage backend the request's lock is
|
|
190
|
+
* extended by the same amount, so the extra time is not spent while the queue considers the request
|
|
191
|
+
* free to hand out again. Calling it from a handler that has already timed out does nothing.
|
|
191
192
|
*/
|
|
192
193
|
extendTimeout(secs: number): void;
|
|
193
194
|
}
|
|
@@ -199,6 +199,12 @@ export declare class ThrottlingRequestManager<T extends IRequestManager = IReque
|
|
|
199
199
|
*/
|
|
200
200
|
purge(): Promise<void>;
|
|
201
201
|
setExpectedRequestProcessingTimeSecs(secs: number): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* @inheritdoc
|
|
204
|
+
* Extending a lock must not consume the in-flight marker that later routes
|
|
205
|
+
* {@link ThrottlingRequestManager.markRequestAsHandled} / {@link ThrottlingRequestManager.reclaimRequest}.
|
|
206
|
+
*/
|
|
207
|
+
extendRequestProcessingTimeSecs(request: Request, secs: number): Promise<boolean>;
|
|
202
208
|
/**
|
|
203
209
|
* Returns the next request from a domain that is not backing off, or from the inner manager.
|
|
204
210
|
*
|
|
@@ -704,6 +704,18 @@ export class ThrottlingRequestManager {
|
|
|
704
704
|
this.#expectedRequestProcessingSecs = secs;
|
|
705
705
|
await this.#forEachManager((manager) => manager.setExpectedRequestProcessingTimeSecs?.(secs));
|
|
706
706
|
}
|
|
707
|
+
/**
|
|
708
|
+
* @inheritdoc
|
|
709
|
+
* Extending a lock must not consume the in-flight marker that later routes
|
|
710
|
+
* {@link ThrottlingRequestManager.markRequestAsHandled} / {@link ThrottlingRequestManager.reclaimRequest}.
|
|
711
|
+
*/
|
|
712
|
+
async extendRequestProcessingTimeSecs(request, secs) {
|
|
713
|
+
const key = request.id ?? request.uniqueKey;
|
|
714
|
+
const manager = this.#inFlightFromInner.has(key)
|
|
715
|
+
? this.#resolvedInner
|
|
716
|
+
: await this.#selectManagerOrThrow(request.url);
|
|
717
|
+
return (await manager.extendRequestProcessingTimeSecs?.(request, secs)) ?? false;
|
|
718
|
+
}
|
|
707
719
|
/**
|
|
708
720
|
* Runs `fn` over the sub-queues and, if it has been resolved, the wrapped manager - bookkeeping never forces
|
|
709
721
|
* a lazily-opened `inner`, since there is no point opening a queue purely to tell it something.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/basic",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.195",
|
|
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.0.0"
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"@apify/datastructures": "^3.0.1",
|
|
43
43
|
"@apify/timeout": "^1.0.1",
|
|
44
44
|
"@apify/utilities": "^3.0.1",
|
|
45
|
-
"@crawlee/core": "4.0.0-beta.
|
|
46
|
-
"@crawlee/http-client": "4.0.0-beta.
|
|
47
|
-
"@crawlee/types": "4.0.0-beta.
|
|
48
|
-
"@crawlee/utils": "4.0.0-beta.
|
|
45
|
+
"@crawlee/core": "4.0.0-beta.195",
|
|
46
|
+
"@crawlee/http-client": "4.0.0-beta.195",
|
|
47
|
+
"@crawlee/types": "4.0.0-beta.195",
|
|
48
|
+
"@crawlee/utils": "4.0.0-beta.195",
|
|
49
49
|
"@sapphire/async-queue": "^1.5.5",
|
|
50
50
|
"@standard-schema/spec": "^1.0.0",
|
|
51
51
|
"csv-stringify": "^6.5.2",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"zod": "^4.5.4"
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"@crawlee/impit-client": "4.0.0-beta.
|
|
60
|
+
"@crawlee/impit-client": "4.0.0-beta.195"
|
|
61
61
|
},
|
|
62
62
|
"lerna": {
|
|
63
63
|
"command": {
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "7ef1df353c43614acc1275a53ef8ca96e850fe3e"
|
|
70
70
|
}
|