@crawlee/core 3.17.1-beta.52 → 3.17.1-beta.54
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlee/core",
|
|
3
|
-
"version": "3.17.1-beta.
|
|
3
|
+
"version": "3.17.1-beta.54",
|
|
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": ">=16.0.0"
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"@apify/pseudo_url": "^2.0.30",
|
|
60
60
|
"@apify/timeout": "^0.3.0",
|
|
61
61
|
"@apify/utilities": "^2.7.10",
|
|
62
|
-
"@crawlee/memory-storage": "3.17.1-beta.
|
|
63
|
-
"@crawlee/types": "3.17.1-beta.
|
|
64
|
-
"@crawlee/utils": "3.17.1-beta.
|
|
62
|
+
"@crawlee/memory-storage": "3.17.1-beta.54",
|
|
63
|
+
"@crawlee/types": "3.17.1-beta.54",
|
|
64
|
+
"@crawlee/utils": "3.17.1-beta.54",
|
|
65
65
|
"@sapphire/async-queue": "^1.5.1",
|
|
66
66
|
"@vladfrangu/async_event_emitter": "^2.2.2",
|
|
67
67
|
"csv-stringify": "^6.2.0",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "45d0756fd5f016539d6e2f80f72340a652ddc48f"
|
|
87
87
|
}
|
|
@@ -336,6 +336,12 @@ export declare class RequestList implements IRequestList {
|
|
|
336
336
|
* @inheritDoc
|
|
337
337
|
*/
|
|
338
338
|
persistState(): Promise<void>;
|
|
339
|
+
/**
|
|
340
|
+
* Removes the `PERSIST_STATE` event listener registered during initialization and persists
|
|
341
|
+
* the current state one last time. Call this when you are done with the `RequestList` to avoid
|
|
342
|
+
* leaking the listener (and the requests it retains) on the shared event manager.
|
|
343
|
+
*/
|
|
344
|
+
teardown(): Promise<void>;
|
|
339
345
|
/**
|
|
340
346
|
* Unlike persistState(), this is used only internally, since the sources
|
|
341
347
|
* are automatically persisted at RequestList initialization (if the persistRequestsKey is set),
|
package/storages/request_list.js
CHANGED
|
@@ -248,6 +248,7 @@ class RequestList {
|
|
|
248
248
|
this.sourcesFunction = sourcesFunction;
|
|
249
249
|
// The proxy configuration used for `requestsFromUrl` requests.
|
|
250
250
|
this.proxyConfiguration = proxyConfiguration;
|
|
251
|
+
this.persistState = this.persistState.bind(this);
|
|
251
252
|
}
|
|
252
253
|
/**
|
|
253
254
|
* Loads all remote sources of URLs and potentially starts periodic state persistence.
|
|
@@ -273,7 +274,7 @@ class RequestList {
|
|
|
273
274
|
if (this.persistRequestsKey && !this.areRequestsPersisted)
|
|
274
275
|
await this._persistRequests();
|
|
275
276
|
if (this.persistStateKey) {
|
|
276
|
-
this.events.on("persistState" /* EventType.PERSIST_STATE */, this.persistState
|
|
277
|
+
this.events.on("persistState" /* EventType.PERSIST_STATE */, this.persistState);
|
|
277
278
|
}
|
|
278
279
|
return this;
|
|
279
280
|
}
|
|
@@ -355,6 +356,17 @@ class RequestList {
|
|
|
355
356
|
this.log.exception(err, 'Attempted to persist state, but failed.');
|
|
356
357
|
}
|
|
357
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* Removes the `PERSIST_STATE` event listener registered during initialization and persists
|
|
361
|
+
* the current state one last time. Call this when you are done with the `RequestList` to avoid
|
|
362
|
+
* leaking the listener (and the requests it retains) on the shared event manager.
|
|
363
|
+
*/
|
|
364
|
+
async teardown() {
|
|
365
|
+
this.events.off("persistState" /* EventType.PERSIST_STATE */, this.persistState);
|
|
366
|
+
if (this.persistStateKey) {
|
|
367
|
+
await this.persistState();
|
|
368
|
+
}
|
|
369
|
+
}
|
|
358
370
|
/**
|
|
359
371
|
* Unlike persistState(), this is used only internally, since the sources
|
|
360
372
|
* are automatically persisted at RequestList initialization (if the persistRequestsKey is set),
|