Because of https://github.com/siimon/prom-client/blob/426941fbc22433fff932d8f9fb09ebba4818f514/index.js#L24, https://github.com/siimon/prom-client/blob/426941fbc22433fff932d8f9fb09ebba4818f514/lib/cluster.js#L131-L170 is always ran
This results in a memory leak if require('prom-client'); is done multiples times and the require.cache is blown away, as might happen in tests.
I get the following after rerunning my tests, which blow away the require cache in order to mock a dep. (node:80194) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit
Because of https://github.com/siimon/prom-client/blob/426941fbc22433fff932d8f9fb09ebba4818f514/index.js#L24, https://github.com/siimon/prom-client/blob/426941fbc22433fff932d8f9fb09ebba4818f514/lib/cluster.js#L131-L170 is always ran
This results in a memory leak if
require('prom-client');is done multiples times and therequire.cacheis blown away, as might happen in tests.I get the following after rerunning my tests, which blow away the require cache in order to mock a dep.
(node:80194) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added. Use emitter.setMaxListeners() to increase limit