Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy load lockfile library #2281

Merged
merged 1 commit into from
Mar 29, 2021
Merged

Lazy load lockfile library #2281

merged 1 commit into from
Mar 29, 2021

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Mar 28, 2021

Motivation

lockfile registers many listeners to process right on require. We only use lockfile on the validator client so it doesn't feel clean to pollute the process with un-used listeners when running the beacon cmd.

Description

Lazy require the library. Trade-off is no types, but the function signatures are extremely simple. Since the lib is used in the constructor using await import() is not nice.

Trace: process.on() call with [ 'SIGABRT', [Function: listener] ]
Trace: process.on() call with [ 'SIGALRM', [Function: listener] ]
Trace: process.on() call with [ 'SIGHUP', [Function: listener] ]
Trace: process.on() call with [ 'SIGINT', [Function: listener] ]
Trace: process.on() call with [ 'SIGTERM', [Function: listener] ]
Trace: process.on() call with [ 'SIGVTALRM', [Function: listener] ]
Trace: process.on() call with [ 'SIGXCPU', [Function: listener] ]
Trace: process.on() call with [ 'SIGXFSZ', [Function: listener] ]
Trace: process.on() call with [ 'SIGUSR2', [Function: listener] ]
Trace: process.on() call with [ 'SIGTRAP', [Function: listener] ]
Trace: process.on() call with [ 'SIGSYS', [Function: listener] ]
Trace: process.on() call with [ 'SIGQUIT', [Function: listener] ]
Trace: process.on() call with [ 'SIGIOT', [Function: listener] ]
Trace: process.on() call with [ 'SIGIO', [Function: listener] ]
Trace: process.on() call with [ 'SIGPOLL', [Function: listener] ]
Trace: process.on() call with [ 'SIGPWR', [Function: listener] ]
Trace: process.on() call with [ 'SIGSTKFLT', [Function: listener] ]
Trace: process.on() call with [ 'SIGUNUSED', [Function: listener] ]
    at process.on (/home/lion/Code/eth2.0/lodestar/packages/cli/lib/index.js:5:11)
    at /home/lion/Code/eth2.0/lodestar/node_modules/signal-exit/index.js:128:15
    at Array.filter (<anonymous>)
    at load (/home/lion/Code/eth2.0/lodestar/node_modules/signal-exit/index.js:126:21)
    at module.exports (/home/lion/Code/eth2.0/lodestar/node_modules/signal-exit/index.js:36:5)
    at Object.<anonymous> (/home/lion/Code/eth2.0/lodestar/node_modules/lockfile/lockfile.js:34:1)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)

@codeclimate
Copy link

codeclimate bot commented Mar 28, 2021

Code Climate has analyzed commit 3c0fd84 and detected 0 issues on this pull request.

View more on Code Climate.

@mpetrunic mpetrunic merged commit b2a1e30 into master Mar 29, 2021
@mpetrunic mpetrunic deleted the dapplion/lazy-load-lockfile branch March 29, 2021 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants