@crawlee/basic 4.0.0-beta.162 → 4.0.0-beta.164

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.
@@ -798,7 +798,11 @@ export class BasicCrawler {
798
798
  stats.reset();
799
799
  await stats.resetStore();
800
800
  });
801
- await this.#sessionPoolDep.ifOwned((pool) => pool.resetStore());
801
+ // A session pool the crawler built follows the same blank-slate rule as its statistics.
802
+ await this.#sessionPoolDep.ifOwned(async (pool) => {
803
+ pool.reset();
804
+ await pool.resetStore();
805
+ });
802
806
  }
803
807
  this.#unexpectedStop = false;
804
808
  this.running = true;
@@ -1773,13 +1777,15 @@ export class BasicCrawler {
1773
1777
  * To stop the crawler gracefully (waiting for all running requests to finish), use {@link BasicCrawler.stop|`crawler.stop()`} instead.
1774
1778
  */
1775
1779
  async teardown() {
1780
+ // First, so that the pool writes its final state once - its teardown stops it listening before the
1781
+ // persistence event below goes out.
1782
+ await this.#sessionPoolDep.ifOwned(async (pool) => pool.teardown());
1776
1783
  // When this crawler initialized the event manager, its close() call emits
1777
1784
  // the final persistence event after the crawler-specific state has been
1778
1785
  // saved. External event managers still need an explicit event here.
1779
1786
  if (!this.#closeEvents) {
1780
1787
  serviceLocator.getEventManager().emit(EventType.PERSIST_STATE, { isMigrating: false });
1781
1788
  }
1782
- await this.#sessionPoolDep.ifOwned(async (pool) => pool.teardown({ persistState: this.#closeEvents ?? false }));
1783
1789
  if (this.#closeEvents) {
1784
1790
  await serviceLocator.getEventManager().close();
1785
1791
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/basic",
3
- "version": "4.0.0-beta.162",
3
+ "version": "4.0.0-beta.164",
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": "^2.0.0",
43
43
  "@apify/timeout": "^0.4.4",
44
44
  "@apify/utilities": "^2.15.5",
45
- "@crawlee/core": "4.0.0-beta.162",
46
- "@crawlee/http-client": "4.0.0-beta.162",
47
- "@crawlee/types": "4.0.0-beta.162",
48
- "@crawlee/utils": "4.0.0-beta.162",
45
+ "@crawlee/core": "4.0.0-beta.164",
46
+ "@crawlee/http-client": "4.0.0-beta.164",
47
+ "@crawlee/types": "4.0.0-beta.164",
48
+ "@crawlee/utils": "4.0.0-beta.164",
49
49
  "csv-stringify": "^6.5.2",
50
50
  "tldts": "^7.0.6",
51
51
  "tslib": "^2.8.1",
@@ -53,7 +53,7 @@
53
53
  "zod": "^4.4.3"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@crawlee/impit-client": "4.0.0-beta.162"
56
+ "@crawlee/impit-client": "4.0.0-beta.164"
57
57
  },
58
58
  "lerna": {
59
59
  "command": {
@@ -62,5 +62,5 @@
62
62
  }
63
63
  }
64
64
  },
65
- "gitHead": "0896509b1e3df39639d2224b2d565fc592939fd7"
65
+ "gitHead": "a2e4e2a3aa3a364c8a44fd2e49ca57f500d2c01f"
66
66
  }