Tests: match concurrency with CPU count

This commit is contained in:
Lovell Fuller 2021-03-14 19:51:45 +00:00
parent 1a3c38d35f
commit a57d7b51b1

View File

@ -1,5 +1,6 @@
'use strict'; 'use strict';
const os = require('os');
const fs = require('fs'); const fs = require('fs');
const async = require('async'); const async = require('async');
@ -25,6 +26,9 @@ const height = 588;
// Disable libvips cache to ensure tests are as fair as they can be // Disable libvips cache to ensure tests are as fair as they can be
sharp.cache(false); sharp.cache(false);
// Spawn one thread per CPU
sharp.concurrency(os.cpus().length);
async.series({ async.series({
jpeg: function (callback) { jpeg: function (callback) {
const inputJpgBuffer = fs.readFileSync(fixtures.inputJpg); const inputJpgBuffer = fs.readFileSync(fixtures.inputJpg);