@forzalabs/remora 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/actions/run.js
CHANGED
|
@@ -22,7 +22,8 @@ const ExecutorOrchestrator_1 = __importDefault(require("../executors/ExecutorOrc
|
|
|
22
22
|
const run = (consumerName, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
try {
|
|
24
24
|
(0, compile_1.compile)();
|
|
25
|
-
|
|
25
|
+
// needed for newline
|
|
26
|
+
console.log();
|
|
26
27
|
const consumersToExecute = [];
|
|
27
28
|
if (consumerName && consumerName.length > 0) {
|
|
28
29
|
const cons = Environment_1.default.getConsumer(consumerName);
|
|
@@ -40,6 +41,10 @@ const run = (consumerName, options) => __awaiter(void 0, void 0, void 0, functio
|
|
|
40
41
|
else {
|
|
41
42
|
consumersToExecute.push(...Environment_1.default._env.consumers);
|
|
42
43
|
}
|
|
44
|
+
if (consumersToExecute.length === 1)
|
|
45
|
+
console.log(chalk_1.default.blue(`Running consumer ${consumersToExecute[0].name}...\n`));
|
|
46
|
+
else
|
|
47
|
+
console.log(chalk_1.default.blue(`Running consumers ${consumersToExecute.map(x => x.name).join(', ')}...\n`));
|
|
43
48
|
const results = [];
|
|
44
49
|
for (let i = 0; i < consumersToExecute.length; i++) {
|
|
45
50
|
const consumer = consumersToExecute[i];
|
|
@@ -150,8 +150,8 @@ class ExecutorOrchestratorClass {
|
|
|
150
150
|
if (fileSize < Constants_1.default.defaults.MIN_FILE_SIZE_FOR_PARALLEL) {
|
|
151
151
|
return [{ start: 0, end: fileSize, isFirstChunk: true, fileUri }];
|
|
152
152
|
}
|
|
153
|
-
// Calculate optimal chunk count based on file size and CPU cores
|
|
154
|
-
const cpus = numChunks !== null && numChunks !== void 0 ? numChunks : os_1.default.cpus().length;
|
|
153
|
+
// Calculate optimal chunk count based on file size and CPU cores (-1 cause it is used by the main thread)
|
|
154
|
+
const cpus = numChunks !== null && numChunks !== void 0 ? numChunks : (os_1.default.cpus().length - 1);
|
|
155
155
|
const maxChunksBySize = Math.floor(fileSize / Constants_1.default.defaults.MIN_CHUNK_SIZE);
|
|
156
156
|
const effectiveChunks = Math.min(cpus, maxChunksBySize);
|
|
157
157
|
if (effectiveChunks <= 1)
|