Skip to content

Option to limit number of processes/threads/fds #424

@vicary

Description

@vicary

Feature motivation

My team is using serverless-webpack to bundle ~100-ish Lambda functions at the same time, due to constraints in serverless-appsync-plugin we cannot split them into multiple batches, and with webpack + ts-loader alone it is impossible to bundle them all at once.

This module opens up the possibility to keep the type checking, but we quickly hit another problem. i.e. With 100 forked processes it drained the fd limit in no time.

While it is possible to raise such limit to millions for one machine, the development cycle becomes exponentially complicated when it comes to CI/CD in containers.

Feature description

In webpack/webpack@9cb4225 webpack itself limits how many files it opens each time, but fork-ts-checker-webpack-plugin multiplies the limit of 15 by the total number of functions to be bundled.

It would be great if there is an option, or at least a sane default, to limit the total number of threads/forked processes.

Feature implementation

Maintain the number of active forks, delaying further forking until earlier child processes is finished, packages like p-limit is worth considering.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions