eslint_d.js icon indicating copy to clipboard operation
eslint_d.js copied to clipboard

Feature Request: Configurable max instances

Open connorgmeehan opened this issue 2 years ago • 5 comments

I would like to be able to reduce the number of instances eslint_d keeps in memory. Currently eslint_d is using 1.3gb of memory with all 10 instances cached. Rather than eslint_d restarting regularly it'd be nice to be able to reduce this to 3-4 instances.

A way of configuring this could be via environment variables

export ESLINT_D_MAX_INSTANCES=5
eslint_d ./file.js

connorgmeehan avatar Jun 15 '22 08:06 connorgmeehan

That makes sense. Would you care to send a PR to implement this?

mantoni avatar Jun 15 '22 10:06 mantoni

Yep I can PR this, I'm noticing there's some references to CORE_D_TITLE should I copy this in the env variable and call it CORE_D_MAX_INSTANCES?

Are there any knock-on effects for testing?

connorgmeehan avatar Jul 07 '22 04:07 connorgmeehan

Great! I think it should be called ESLINT_D_MAX_INSTANCES because the cache is implemented here. You can see examples for testing in eslint-path-test.

mantoni avatar Jul 07 '22 06:07 mantoni

I've made the changes + added some error checking for invalid inputs but I'm having some trouble testing it. I've never developed a node CLI package before. What's the best way to run my branch of eslint_d on my machine. I've tried yarn global add "file:$PWD" and npm link.

connorgmeehan avatar Jul 14 '22 00:07 connorgmeehan

npm link worked fine for me when testing. But you can also simply invoke the bin/eslint_d.js file from anywhere.

mantoni avatar Jul 15 '22 20:07 mantoni