@crawlee/core 4.0.0-beta.132 → 4.0.0-beta.134

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.
@@ -211,6 +211,7 @@ export declare class ConcurrencySystem implements IConcurrencySystem {
211
211
  */
212
212
  start(): Promise<void>;
213
213
  private boot;
214
+ [Symbol.asyncDispose](): Promise<void>;
214
215
  /**
215
216
  * Stops the snapshotter and intervals. Idempotent and safe to call even if the system was never started.
216
217
  */
@@ -198,6 +198,9 @@ export class ConcurrencySystem {
198
198
  // Last, so `isRunning` never claims a system whose signals aren't collecting yet.
199
199
  this.#running = true;
200
200
  }
201
+ async [Symbol.asyncDispose]() {
202
+ await this.stop();
203
+ }
201
204
  /**
202
205
  * Stops the snapshotter and intervals. Idempotent and safe to call even if the system was never started.
203
206
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/core",
3
- "version": "4.0.0-beta.132",
3
+ "version": "4.0.0-beta.134",
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"
@@ -52,10 +52,10 @@
52
52
  "@apify/log": "^2.5.18",
53
53
  "@apify/timeout": "^0.4.4",
54
54
  "@apify/utilities": "^2.15.5",
55
- "@crawlee/fs-storage": "4.0.0-beta.132",
56
- "@crawlee/http-client": "4.0.0-beta.132",
57
- "@crawlee/types": "4.0.0-beta.132",
58
- "@crawlee/utils": "4.0.0-beta.132",
55
+ "@crawlee/fs-storage": "4.0.0-beta.134",
56
+ "@crawlee/http-client": "4.0.0-beta.134",
57
+ "@crawlee/types": "4.0.0-beta.134",
58
+ "@crawlee/utils": "4.0.0-beta.134",
59
59
  "@sapphire/async-queue": "^1.5.5",
60
60
  "@standard-schema/spec": "^1.0.0",
61
61
  "@vladfrangu/async_event_emitter": "^2.4.6",
@@ -78,5 +78,5 @@
78
78
  }
79
79
  }
80
80
  },
81
- "gitHead": "766e1b559dab6051b353e8cf52a04d189a27dd91"
81
+ "gitHead": "0f269d5b24ec2829f3d44c19a35973fa20d95999"
82
82
  }
@@ -178,6 +178,7 @@ export declare class SessionPool implements ISessionPool {
178
178
  * @param options - Override the persistence options provided in the constructor
179
179
  */
180
180
  persistState(options?: PersistenceOptions): Promise<void>;
181
+ [Symbol.asyncDispose](): Promise<void>;
181
182
  /**
182
183
  * Removes listener from `persistState` event.
183
184
  * This function should be called after you are done with using the `SessionPool` instance.
@@ -261,6 +261,9 @@ export class SessionPool {
261
261
  ?.setValue(this.persistStateKey, await this.getState())
262
262
  .catch((error) => this.#log.warning(`Failed to persist the session pool stats to ${this.persistStateKey}`, { error }));
263
263
  }
264
+ async [Symbol.asyncDispose]() {
265
+ await this.teardown({ persistState: true });
266
+ }
264
267
  /**
265
268
  * Removes listener from `persistState` event.
266
269
  * This function should be called after you are done with using the `SessionPool` instance.