1- import { shuffleArrMutable , isString , isFunction , isAsyncFunction } from 'sat-utils' ;
1+ import { isString , isFunction , isAsyncFunction } from 'sat-utils' ;
22import { buildCommandExecutor } from './command.executor.builder' ;
33import { sleep } from './helpers' ;
44import { logger } from './logger' ;
5- import {
6- internalLogStartCycle ,
7- internalLogEndCycle ,
8- internalLogMiddleResultsCycle ,
9- internalLogIntimeCommand ,
10- } from './logger.execution' ;
11-
12- async function intimeExecutor ( runOptions , commandsArray ) : Promise < { retriable : string [ ] ; notRetriable : string [ ] } > {
5+ import { internalLogStartCycle , internalLogEndCycle , internalLogIntimeCommand } from './logger.execution' ;
6+
7+ import type { TBuildOpts } from './lib.types' ;
8+
9+ async function intimeExecutor (
10+ runOptions : TBuildOpts ,
11+ commandsArray ,
12+ ) : Promise < { retriable : string [ ] ; notRetriable : string [ ] } > {
1313 const notRetriable = [ ] ;
1414 const retriable = [ ] ;
1515
@@ -23,12 +23,9 @@ async function intimeExecutor(runOptions, commandsArray): Promise<{ retriable: s
2323 successExitCode,
2424 currentExecutionVariable,
2525 maxThreads,
26- shuffle,
2726 watcher,
28- logProcessesProgress,
2927 logStartCycle = internalLogStartCycle ,
3028 logEndCycle = internalLogEndCycle ,
31- logMiddleResultsCycle = internalLogMiddleResultsCycle ,
3229 logIntimeCommand = internalLogIntimeCommand ,
3330 execOpts,
3431 } = runOptions ;
@@ -53,9 +50,7 @@ async function intimeExecutor(runOptions, commandsArray): Promise<{ retriable: s
5350 async function runCommand ( commands ) {
5451 if ( maxThreads > currentSessionCount && commands . length ) {
5552 currentSessionCount += 1 ;
56- if ( shuffle ) {
57- shuffleArrMutable ( commands ) ;
58- }
53+
5954 let result ;
6055 const commadData = commands . splice ( 0 , 1 ) [ 0 ] as { cmd ; attemptsCount : number } ;
6156
@@ -90,11 +85,18 @@ async function intimeExecutor(runOptions, commandsArray): Promise<{ retriable: s
9085 const initialCommandsCount = commands . length ;
9186 const asserter = setInterval ( ( ) => runCommand ( commands ) , pollTime ) ;
9287
93- const logProcessesProgressLoggerRunner =
94- logProcessesProgress &&
95- setInterval ( ( ) => logMiddleResultsCycle ( initialCommandsCount , commands , inProgressCommands ) , 5000 ) ;
96-
97- const watcherRunner = watcher && setInterval ( ( ) => watcher ( Array . from ( notRetriable ) , Array . from ( retriable ) ) , 5000 ) ;
88+ const watcherRunner =
89+ watcher &&
90+ setInterval (
91+ ( ) =>
92+ watcher ( {
93+ notRetriable : Array . from ( notRetriable ) ,
94+ retriable : Array . from ( retriable ) ,
95+ inProgressCommands : Array . from ( inProgressCommands ) ,
96+ initialCommandsCount,
97+ } ) ,
98+ 5000 ,
99+ ) ;
98100
99101 do {
100102 if ( commands . length ) {
@@ -109,9 +111,7 @@ async function intimeExecutor(runOptions, commandsArray): Promise<{ retriable: s
109111 ) ;
110112
111113 clearInterval ( asserter ) ;
112- if ( logProcessesProgressLoggerRunner ) {
113- clearInterval ( logProcessesProgressLoggerRunner ) ;
114- }
114+
115115 if ( watcherRunner ) {
116116 clearInterval ( watcherRunner ) ;
117117 }
0 commit comments