Run multi-target commands in parallel (#26)
CI / Lint (eslint) (pull_request) Successful in 27s
CI / Test (jest) (pull_request) Successful in 19s
CI / Security (npm audit) (pull_request) Successful in 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m58s
CI / Integration (api) (pull_request) Successful in 2m49s
CI / UI (playwright) (pull_request) Successful in 2m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m6s
CI / Lint (eslint) (pull_request) Successful in 27s
CI / Test (jest) (pull_request) Successful in 19s
CI / Security (npm audit) (pull_request) Successful in 12s
CI / Scan (secrets, workflows, shell) (pull_request) Successful in 1m58s
CI / Integration (api) (pull_request) Successful in 2m49s
CI / UI (playwright) (pull_request) Successful in 2m15s
CI / Deploy (pull_request) Skipped
CI / Deploy worker (pull_request) Skipped
CI / Notify (pull_request) Skipped
CI / UI screenshots (before/after) (pull_request) Successful in 2m6s
- Workflow execute steps send to all targets at once and wait for every result (Promise.all), so one slow or hung worker no longer holds up the rest; any failed target fails the step. parallel: false keeps the old one-at-a-time order, stopping at the first failure, for rolling changes. (Log appends are atomic in SQL, so concurrent targets can't lose entries.) - Quick Command's multi-worker mode sends to every selected worker at once. - Integration tests: 3 workers x 2 s finish in about 2 s; parallel: false takes 6 s or more; one failing target fails the step after all report. - README: the parallel field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
06d6c72709
commit
abb4b9326f
4 files changed
+63
-33
No files matched your search
@@ -248,21 +248,19 @@
|
||||
return;
|
||||
}
|
||||
renderExecuting(workerIds.length);
|
||||
const results = [];
|
||||
let successCount = 0;
|
||||
let failCount = 0;
|
||||
for (const workerId of workerIds) {
|
||||
// Send to every selected worker at once (#26); results keep the selection order.
|
||||
const results = await Promise.all(workerIds.map(async (workerId) => {
|
||||
const worker = _workers.find(w => w.id === workerId);
|
||||
const workerLabel = worker ? worker.name : workerId;
|
||||
try {
|
||||
const data = await Pulse.api.post('/api/workers/' + encodeURIComponent(workerId) + '/command', { command });
|
||||
results.push({ worker: workerLabel, success: true, executionId: data && data.execution_id });
|
||||
successCount++;
|
||||
return { worker: workerLabel, success: true, executionId: data && data.execution_id };
|
||||
} catch (e) {
|
||||
results.push({ worker: workerLabel, success: false, error: e.message || 'Failed to execute' });
|
||||
failCount++;
|
||||
return { worker: workerLabel, success: false, error: e.message || 'Failed to execute' };
|
||||
}
|
||||
}
|
||||
}));
|
||||
const successCount = results.filter(r => r.success).length;
|
||||
const failCount = results.length - successCount;
|
||||
addToHistory(command, workerIds.length + ' workers');
|
||||
renderMultiResult(results, successCount, failCount);
|
||||
if (failCount === 0) Pulse.beep('success');
|
||||
|
||||
Reference in new issue
Block a user