Skip to content

Allow setting cpu concurrency values for packaging #13045

Description

@alexelshamouty

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Use case description

In proot environment and in other cases where conserving CPU is a priority, one sometimes needs to have control over the concurrency value.

Example: Iran into an issue today when using the serverless framework and trying to deploy and application.

It seems that os.cpus() returns an empty list when running in proot. Which eventually triggered p-map to throw an exception

		if (!((Number.isSafeInteger(concurrency) && concurrency >= 1) || concurrency === Number.POSITIVE_INFINITY)) {
			throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
		}

When called from zip-service.js

       return pMap(normalizedFiles, this.getFileContentAndStat.bind(this), {
          concurrency: os.cpus().length
        })

I've managed to fix this for myself by setting the concurrency value manually in sf-core.js but thought it would be handy even in the case of CI/CD

Therefore, I opened this PR
#13044

Proposed solution (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions