@crawlee/browser-pool 4.0.0-beta.187 → 4.0.0-beta.189

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.
Files changed (2) hide show
  1. package/browser-pool.js +5 -3
  2. package/package.json +5 -5
package/browser-pool.js CHANGED
@@ -102,15 +102,13 @@ export class BrowserPool extends TypedEmitter {
102
102
  fingerprintInjector;
103
103
  fingerprintGenerator;
104
104
  fingerprintCache;
105
- // kept as TS-private: tests replace this interval through bracket access
106
- browserKillerInterval = setInterval(async () => this.closeInactiveRetiredBrowsers(), BROWSER_KILLER_INTERVAL_MILLIS);
105
+ browserKillerInterval;
107
106
  #browserRetireInterval;
108
107
  #limiter = pLimit(1);
109
108
  #log;
110
109
  constructor(options) {
111
110
  super();
112
111
  this.#log = serviceLocator.getLogger().child({ prefix: 'BrowserPool' });
113
- this.browserKillerInterval.unref();
114
112
  const { browserPlugins, maxOpenPagesPerBrowser, retireBrowserAfterPageCount, operationTimeoutSecs, closeInactiveBrowserAfterSecs, retireInactiveBrowserAfterSecs, preLaunchHooks, postLaunchHooks, prePageCreateHooks, postPageCreateHooks, prePageCloseHooks, postPageCloseHooks, useFingerprints, fingerprintOptions, } = parseArgument(options, browserPoolOptionsSchema);
115
113
  const firstPluginConstructor = browserPlugins[0].constructor;
116
114
  for (let i = 1; i < browserPlugins.length; i++) {
@@ -127,6 +125,10 @@ export class BrowserPool extends TypedEmitter {
127
125
  this.retireBrowserAfterPageCount = retireBrowserAfterPageCount;
128
126
  this.operationTimeoutMillis = operationTimeoutSecs * 1000;
129
127
  this.closeInactiveBrowserAfterMillis = closeInactiveBrowserAfterSecs * 1000;
128
+ // Sweeping slower than the window it enforces would round any sub-10s
129
+ // `closeInactiveBrowserAfterSecs` up to the sweep period.
130
+ this.browserKillerInterval = setInterval(async () => this.closeInactiveRetiredBrowsers(), Math.min(BROWSER_KILLER_INTERVAL_MILLIS, this.closeInactiveBrowserAfterMillis));
131
+ this.browserKillerInterval.unref();
130
132
  this.useFingerprints = useFingerprints;
131
133
  this.fingerprintOptions = fingerprintOptions;
132
134
  this.#browserRetireInterval = setInterval(async () => this.activeBrowserControllers.forEach((controller) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlee/browser-pool",
3
- "version": "4.0.0-beta.187",
3
+ "version": "4.0.0-beta.189",
4
4
  "description": "Rotate multiple browsers using popular automation libraries such as Playwright or Puppeteer.",
5
5
  "engines": {
6
6
  "node": ">=22.0.0"
@@ -31,9 +31,9 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@apify/timeout": "^1.0.1",
34
- "@crawlee/core": "4.0.0-beta.187",
35
- "@crawlee/types": "4.0.0-beta.187",
36
- "@crawlee/utils": "4.0.0-beta.187",
34
+ "@crawlee/core": "4.0.0-beta.189",
35
+ "@crawlee/types": "4.0.0-beta.189",
36
+ "@crawlee/utils": "4.0.0-beta.189",
37
37
  "fingerprint-generator": "^2.1.68",
38
38
  "fingerprint-injector": "^2.1.68",
39
39
  "lodash.merge": "^4.6.2",
@@ -64,5 +64,5 @@
64
64
  }
65
65
  }
66
66
  },
67
- "gitHead": "1281760f20f7ee1181e3171d759efb055647e6c5"
67
+ "gitHead": "1dbb0f272b9da9c7a6bf3bdc1ae48f84eda3f21c"
68
68
  }