@nsshunt/stsrunnerframework 1.0.61 → 1.0.62

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.
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value2) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value2);
10
10
  var __privateSet = (obj, member, value2, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value2) : member.set(obj, value2), value2);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _collectorCollectorPort, _runners, _options3, _workerId, _debug, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _StartRunner, _StopRunnerByRunnerById, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options4, _STSInstrumentController, _telemetryProcessor, _debug2, _STSWorkerManager_instances, CreateRunnerCopy_fn, _SetRunnerIntoWorker, _ProcessTelemetry, _RunnerStateChange, _ProcessCompleted, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _BroadcastCommandToAllRunners, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _BroadcastUpdateCommandToAllRunners, _UpdateOptionsWorker, _TerminateWorker, _UpdateOptions2, _options5, _rest01Client, _accessToken2, _agentManager, _authUtilsNode, _GetAccessToken;
12
+ var _collectorCollectorPort, _runners, _options3, _workerId, _debug, _SetMessagePort, _CreateRunnerEx2RunState, _UpdateRunnerStateById, _GetAllRunners, _CanExecuteNextIterationById, _IsCompletedById, _GetRunnerIterationById, _ResetRunnerIterationById, _IncRunnerIterationById, _GetRunnerInstanceById, _GetRunnerExecutionProfileById, _GetRunnerOptionsById, _SetRunnerOptionsById, _AddRunner, _WorkerInstance_instances, SleepImmediate_fn, _PostMessageToWorkerManagerById, _StartRunner, _StopRunnerByRunnerById, _StopAllRunners, _StopRunner, _TerminateRunner, _PauseRunner, _ResumeRunner, _ResetRunner, _ExecuteRunner, _UpdateOptions, _workersEx, _options4, _STSInstrumentController, _telemetryProcessor, _debug2, _STSWorkerManager_instances, CreateRunnerCopy_fn, _SetRunnerIntoWorker, _ProcessTelemetry, _RunnerStateChange, _ProcessCompleted, _CreateAsyncRunner, _PostMessageToWorkerUsingDefaultChannel, _PostMessageToWorker, _StartRunner2, _ResetRunner2, _ExecuteRunner2, _StopRunner2, _TerminateRunner2, _PauseRunner2, _ResumeRunner2, _BroadcastCommandToAllRunners, _PauseWorker, _ResumeWorker, _StopWorker, _StartWorker, _ResetWorker, _ExecuteWorker, _BroadcastUpdateCommandToAllRunners, _UpdateOptionsWorker, _TerminateWorker, _UpdateOptions2, _options5, _rest01Client, _accessToken2, _agentManager, _authUtilsNode, _GetAccessToken;
13
13
  import { Sleep, ModelDelimeter, STSAxiosConfig, GetErrorPayload, AgentManager, defaultLogger } from "@nsshunt/stsutils";
14
14
  import { Gauge } from "@nsshunt/stsobservability";
15
15
  import { accessSync, constants as constants$2, readFileSync } from "node:fs";
@@ -1622,6 +1622,13 @@ class WorkerInstance {
1622
1622
  }
1623
1623
  return false;
1624
1624
  });
1625
+ __privateAdd(this, _IsCompletedById, (id) => {
1626
+ const state = __privateGet(this, _runners)[id].runner.state;
1627
+ if (state === IRunnerState.error || state === IRunnerState.completed || state === IRunnerState.stopped || state === IRunnerState.terminated) {
1628
+ return true;
1629
+ }
1630
+ return false;
1631
+ });
1625
1632
  __privateAdd(this, _GetRunnerIterationById, (id) => {
1626
1633
  return __privateGet(this, _runners)[id].runner.iteration;
1627
1634
  });
@@ -1685,8 +1692,10 @@ class WorkerInstance {
1685
1692
  }
1686
1693
  ExecuteLoop();
1687
1694
  } else {
1688
- await Sleep(50);
1689
- ExecuteLoop();
1695
+ if (!__privateGet(this, _IsCompletedById).call(this, runnerId)) {
1696
+ await Sleep(50);
1697
+ ExecuteLoop();
1698
+ }
1690
1699
  }
1691
1700
  } else {
1692
1701
  await __privateGet(this, _GetRunnerInstanceById).call(this, runnerId).Completed();
@@ -1842,6 +1851,7 @@ _CreateRunnerEx2RunState = new WeakMap();
1842
1851
  _UpdateRunnerStateById = new WeakMap();
1843
1852
  _GetAllRunners = new WeakMap();
1844
1853
  _CanExecuteNextIterationById = new WeakMap();
1854
+ _IsCompletedById = new WeakMap();
1845
1855
  _GetRunnerIterationById = new WeakMap();
1846
1856
  _ResetRunnerIterationById = new WeakMap();
1847
1857
  _IncRunnerIterationById = new WeakMap();
@@ -2174,6 +2184,9 @@ class STSWorkerManager {
2174
2184
  }
2175
2185
  }
2176
2186
  });
2187
+ //@@ make this have an event
2188
+ //@@ make refactor event to own method
2189
+ //@@ check for other events to capture
2177
2190
  __privateAdd(this, _RunnerStateChange, (workerEx, payloadContents) => {
2178
2191
  const { runner } = payloadContents;
2179
2192
  if (workerEx.runnersEx[runner.id]) {