You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more a feature request to make esbuild service management easier for NodeJS.
Currently when a service is started, it does not allow NodeJS to terminate and requires the consumers to explicitly call stop().
Since stop() must be explicitly called, there is currently no way to keep esbuild service running for the whole life of the application. In some circumstances have to manually invoke stop() becomes complicated to manage, and the other only available option is instead to restart and stop the service at every transformation, with of course the performance costs associated to that.
NodeJS supports unref() of child processes and child streams from the main loop, so if there is no operation in progress the application can terminate gracefully without the need to manually kill the child process. See https://nodejs.org/api/child_process.html#child_process_subprocess_unref
In this way is possible to keep an instance of the service always running and warmed up, improving compilation times in the application lifetime. Since the service is already reference counted, a consumer could simply call startService() at application start and call the static transform(), build() or serve() without the need to reference the service directly or the need to stop the service and still having a single esbuild child process running for the whole application lifetime.
In the pull request #656 there is already an implementation and is safe for any normal usage of the library by third parties. There is no change to the current APIs.
I would really appreciate if you could review this PR, thanks!
The text was updated successfully, but these errors were encountered:
This is more a feature request to make esbuild service management easier for NodeJS.
Currently when a service is started, it does not allow NodeJS to terminate and requires the consumers to explicitly call stop().
Since stop() must be explicitly called, there is currently no way to keep esbuild service running for the whole life of the application. In some circumstances have to manually invoke stop() becomes complicated to manage, and the other only available option is instead to restart and stop the service at every transformation, with of course the performance costs associated to that.
NodeJS supports unref() of child processes and child streams from the main loop, so if there is no operation in progress the application can terminate gracefully without the need to manually kill the child process. See https://nodejs.org/api/child_process.html#child_process_subprocess_unref
In this way is possible to keep an instance of the service always running and warmed up, improving compilation times in the application lifetime. Since the service is already reference counted, a consumer could simply call startService() at application start and call the static transform(), build() or serve() without the need to reference the service directly or the need to stop the service and still having a single esbuild child process running for the whole application lifetime.
In the pull request #656 there is already an implementation and is safe for any normal usage of the library by third parties. There is no change to the current APIs.
I would really appreciate if you could review this PR, thanks!
The text was updated successfully, but these errors were encountered: