@crawlee/basic 4.0.0-beta.236 → 4.0.0-beta.237

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.
@@ -795,18 +795,6 @@ export class BasicCrawler {
795
795
  if (this.running) {
796
796
  throw new Error('This crawler instance is already running, you can add more requests to it via `crawler.addRequests()`.');
797
797
  }
798
- if (this.#hasFinishedBefore) {
799
- // A supplied statistics instance keeps whatever state it was handed - only wipe a default we built.
800
- await this.#statisticsDep.ifOwned(async (stats) => {
801
- stats.reset();
802
- await stats.resetStore();
803
- });
804
- // A session pool the crawler built follows the same blank-slate rule as its statistics.
805
- await this.#sessionPoolDep.ifOwned(async (pool) => {
806
- pool.reset();
807
- await pool.resetStore();
808
- });
809
- }
810
798
  // An owned governor is rebuilt for every run, so it always starts from a clean slate — stale
811
799
  // resource snapshots or a previous run's scaled desired concurrency would otherwise distort this
812
800
  // run's scaling. An injected one is long-lived and its lifecycle belongs to the caller.
@@ -819,6 +807,18 @@ export class BasicCrawler {
819
807
  });
820
808
  this.#run = run;
821
809
  try {
810
+ if (this.#hasFinishedBefore) {
811
+ // A supplied statistics instance keeps whatever state it was handed - only wipe a default we built.
812
+ await this.#statisticsDep.ifOwned(async (stats) => {
813
+ stats.reset();
814
+ await stats.resetStore();
815
+ });
816
+ // A session pool the crawler built follows the same blank-slate rule as its statistics.
817
+ await this.#sessionPoolDep.ifOwned(async (pool) => {
818
+ pool.reset();
819
+ await pool.resetStore();
820
+ });
821
+ }
822
822
  await purgeDefaultStorages({
823
823
  onlyPurgeOnce: true,
824
824
  storageBackend: serviceLocator.getStorageBackend(),
@@ -38,6 +38,8 @@ export class CrawlerRun {
38
38
  * running by now — the task loop refuses to book anything against one that is not.
39
39
  */
40
40
  async dispatchRequests() {
41
+ if (this.#ended)
42
+ return;
41
43
  this.#dispatching = true;
42
44
  try {
43
45
  await this.#autoscaledPool.run();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/basic",
3
- "version": "4.0.0-beta.236",
3
+ "version": "4.0.0-beta.237",
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"
@@ -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.236",
46
- "@crawlee/http-client": "4.0.0-beta.236",
47
- "@crawlee/types": "4.0.0-beta.236",
48
- "@crawlee/utils": "4.0.0-beta.236",
45
+ "@crawlee/core": "4.0.0-beta.237",
46
+ "@crawlee/http-client": "4.0.0-beta.237",
47
+ "@crawlee/types": "4.0.0-beta.237",
48
+ "@crawlee/utils": "4.0.0-beta.237",
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.236"
60
+ "@crawlee/impit-client": "4.0.0-beta.237"
61
61
  },
62
62
  "lerna": {
63
63
  "command": {
@@ -66,5 +66,5 @@
66
66
  }
67
67
  }
68
68
  },
69
- "gitHead": "2fd655a2eda0a16125ebeb455ec835d9386d8846"
69
+ "gitHead": "e661302cd88d98ea3c54721440cd5b23ec876102"
70
70
  }