@crawlee/basic 4.0.0-beta.179 → 4.0.0-beta.180
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.
|
@@ -374,8 +374,7 @@ export class BasicCrawler {
|
|
|
374
374
|
})
|
|
375
375
|
: suppliedManager;
|
|
376
376
|
if (requestList !== undefined) {
|
|
377
|
-
// The list is read first, while new requests still have somewhere writable to go
|
|
378
|
-
// forwards `persistState()` to the loader.
|
|
377
|
+
// The list is read first, while new requests still have somewhere writable to go.
|
|
379
378
|
this.requestManager = new RequestManagerTandem(requestList, writableManager ?? (() => this.openOwnedRequestQueue()));
|
|
380
379
|
}
|
|
381
380
|
else if (writableManager !== undefined) {
|
|
@@ -1497,26 +1496,9 @@ export class BasicCrawler {
|
|
|
1497
1496
|
}
|
|
1498
1497
|
});
|
|
1499
1498
|
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
if (this.requestManager?.persistState) {
|
|
1504
|
-
if ((await this.requestManager.checkReadiness()).status === 'finished')
|
|
1505
|
-
return;
|
|
1506
|
-
await this.requestManager.persistState().catch((err) => {
|
|
1507
|
-
if (err.message.includes('Cannot persist state.')) {
|
|
1508
|
-
this.log.error("The crawler attempted to persist its request list's state and failed due to missing or " +
|
|
1509
|
-
'invalid configuration. Make sure to use either RequestList.open() or the "stateKeyPrefix" option of RequestList ' +
|
|
1510
|
-
'constructor to ensure your crawling state is persisted through host migrations and restarts.');
|
|
1511
|
-
}
|
|
1512
|
-
else {
|
|
1513
|
-
this.log.exception(err, 'An unexpected error occurred when the crawler ' +
|
|
1514
|
-
"attempted to persist its request list's state.");
|
|
1515
|
-
}
|
|
1516
|
-
});
|
|
1517
|
-
}
|
|
1518
|
-
})();
|
|
1519
|
-
await Promise.all([requestManagerPersistPromise, this.statistics.persistState?.()]);
|
|
1499
|
+
// Captures the statistics changed while draining above. No PERSIST_STATE event is tied to the drain:
|
|
1500
|
+
// the periodic one is unrelated, and the one the platform emits on migration arrives before any of this.
|
|
1501
|
+
await this.statistics.persistState?.();
|
|
1520
1502
|
}
|
|
1521
1503
|
/**
|
|
1522
1504
|
* Fetches the next request to process from the underlying request provider.
|
|
@@ -212,6 +212,5 @@ export declare class ThrottlingRequestManager<T extends IRequestManager = IReque
|
|
|
212
212
|
*/
|
|
213
213
|
fetchNextRequest<R extends Dictionary = Dictionary>(): Promise<Request<R> | null>;
|
|
214
214
|
[Symbol.asyncIterator](): AsyncGenerator<Request<Dictionary>, void, unknown>;
|
|
215
|
-
persistState(): Promise<void>;
|
|
216
215
|
drop(): Promise<void>;
|
|
217
216
|
}
|
|
@@ -818,9 +818,6 @@ export class ThrottlingRequestManager {
|
|
|
818
818
|
yield req;
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
-
async persistState() {
|
|
822
|
-
await this.#forEachManager((manager) => manager.persistState?.());
|
|
823
|
-
}
|
|
824
821
|
async drop() {
|
|
825
822
|
await this.#forEachManager((manager) => manager.drop?.());
|
|
826
823
|
this.#subManagers.clear();
|
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.180",
|
|
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.180",
|
|
46
|
+
"@crawlee/http-client": "4.0.0-beta.180",
|
|
47
|
+
"@crawlee/types": "4.0.0-beta.180",
|
|
48
|
+
"@crawlee/utils": "4.0.0-beta.180",
|
|
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.180"
|
|
61
61
|
},
|
|
62
62
|
"lerna": {
|
|
63
63
|
"command": {
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "4adb7b0a96ee16824ee53d18f437961d9287f977"
|
|
70
70
|
}
|