Skip to content

Commit 2e76049

Browse files
committed
fix: only copy of settings is passed on to launcher
Chrome-launcher mutates settings, so that if they are passed over from one instance to another it eventually goes OOM
1 parent 22f5bf4 commit 2e76049

File tree

3 files changed

+10
-36
lines changed

3 files changed

+10
-36
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"prom-client": "^11.5.3",
3838
"request": "^2.88.0",
3939
"request-promise": "^4.2.2",
40+
"rfdc": "^1.1.4",
4041
"stdout-stream": "^1.4.1"
4142
},
4243
"devDependencies": {

src/utils/chrome.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const ChromeRemote = require('chrome-remote-interface');
44
const { encode } = require('64');
55
const { Launcher } = require('chrome-launcher');
66
const { HttpStatusError } = require('common-errors');
7-
7+
const clone = require('rfdc')({ proto: false, circles: false });
88
const debug = require('debug')('ms-printer:chrome');
99

1010
const _SIGINT = 'SIGINT';
@@ -17,7 +17,7 @@ class Chrome {
1717
* @return {Promise<Launcher>}
1818
*/
1919
static async launch(settings) {
20-
const launcher = new Launcher(settings);
20+
const launcher = new Launcher(clone(settings));
2121

2222
try {
2323
await launcher.launch();

yarn.lock

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,7 +2464,7 @@ debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
24642464
dependencies:
24652465
ms "^2.1.1"
24662466

2467-
debuglog@*, debuglog@^1.0.1:
2467+
debuglog@^1.0.1:
24682468
version "1.0.1"
24692469
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
24702470
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
@@ -3841,7 +3841,7 @@ import-local@^2.0.0:
38413841
pkg-dir "^3.0.0"
38423842
resolve-cwd "^2.0.0"
38433843

3844-
imurmurhash@*, imurmurhash@^0.1.4:
3844+
imurmurhash@^0.1.4:
38453845
version "0.1.4"
38463846
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
38473847
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
@@ -5068,11 +5068,6 @@ lockfile@^1.0.4:
50685068
dependencies:
50695069
signal-exit "^3.0.2"
50705070

5071-
lodash._baseindexof@*:
5072-
version "3.1.0"
5073-
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
5074-
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=
5075-
50765071
lodash._baseuniq@~4.6.0:
50775072
version "4.6.0"
50785073
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
@@ -5081,33 +5076,11 @@ lodash._baseuniq@~4.6.0:
50815076
lodash._createset "~4.0.0"
50825077
lodash._root "~3.0.0"
50835078

5084-
lodash._bindcallback@*:
5085-
version "3.0.1"
5086-
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
5087-
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=
5088-
5089-
lodash._cacheindexof@*:
5090-
version "3.0.2"
5091-
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
5092-
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=
5093-
5094-
lodash._createcache@*:
5095-
version "3.1.2"
5096-
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
5097-
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
5098-
dependencies:
5099-
lodash._getnative "^3.0.0"
5100-
51015079
lodash._createset@~4.0.0:
51025080
version "4.0.3"
51035081
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
51045082
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=
51055083

5106-
lodash._getnative@*, lodash._getnative@^3.0.0:
5107-
version "3.9.1"
5108-
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
5109-
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
5110-
51115084
lodash._reinterpolate@^3.0.0:
51125085
version "3.0.0"
51135086
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
@@ -5173,11 +5146,6 @@ lodash.reduce@^4.6.0:
51735146
resolved "https://registry.yarnpkg.com/lodash.reduce/-/lodash.reduce-4.6.0.tgz#f1ab6b839299ad48f784abbf476596f03b914d3b"
51745147
integrity sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=
51755148

5176-
lodash.restparam@*:
5177-
version "3.6.1"
5178-
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
5179-
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
5180-
51815149
lodash.set@^4.3.2:
51825150
version "4.3.2"
51835151
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
@@ -7259,6 +7227,11 @@ reusify@^1.0.0:
72597227
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
72607228
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
72617229

7230+
rfdc@^1.1.4:
7231+
version "1.1.4"
7232+
resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.1.4.tgz#ba72cc1367a0ccd9cf81a870b3b58bd3ad07f8c2"
7233+
integrity sha512-5C9HXdzK8EAqN7JDif30jqsBzavB7wLpaubisuQIGHWf2gUXSpzy6ArX/+Da8RjFpagWsCn+pIgxTMAmKw9Zug==
7234+
72627235
rimraf@2, rimraf@2.6.3, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.6.3:
72637236
version "2.6.3"
72647237
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab"

0 commit comments

Comments
 (0)