@nsshunt/stsrunnerframework 1.0.136 → 1.0.138

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.
@@ -1813,14 +1813,18 @@ class WorkerInstance {
1813
1813
  await Sleep(0);
1814
1814
  const startLoop = /* @__PURE__ */ new Date();
1815
1815
  const ExecuteLoop = async () => {
1816
- var _a2, _b;
1816
+ var _a2, _b, _c;
1817
1817
  try {
1818
1818
  let cont = true;
1819
1819
  const executionProfile = __privateGet(this, _GetRunnerExecutionProfileById).call(this, runnerId);
1820
1820
  if (executionProfile) {
1821
- const { iterations, duration, delayBetweenIterations } = executionProfile;
1821
+ const { iterations, duration, delayBetweenIterations, pauseOnComplete } = executionProfile;
1822
1822
  if (iterations > 0) {
1823
- cont = __privateGet(this, _GetRunnerIterationById).call(this, runnerId) < iterations;
1823
+ if (pauseOnComplete === true) {
1824
+ cont = __privateGet(this, _GetRunnerIterationById).call(this, runnerId) <= iterations;
1825
+ } else {
1826
+ cont = __privateGet(this, _GetRunnerIterationById).call(this, runnerId) < iterations;
1827
+ }
1824
1828
  } else if (duration > 0) {
1825
1829
  cont = ((/* @__PURE__ */ new Date()).getTime() - startLoop.getTime()) / 1e3 < duration;
1826
1830
  }
@@ -1845,8 +1849,14 @@ class WorkerInstance {
1845
1849
  }
1846
1850
  }
1847
1851
  } else {
1848
- await ((_b = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _b.Completed());
1849
- __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.completed);
1852
+ if (pauseOnComplete === true) {
1853
+ await ((_b = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _b.PauseRunner());
1854
+ __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.paused);
1855
+ ExecuteLoop();
1856
+ } else {
1857
+ await ((_c = __privateGet(this, _GetRunnerInstanceById).call(this, runnerId)) == null ? void 0 : _c.Completed());
1858
+ __privateGet(this, _UpdateRunnerStateById).call(this, runnerId, IRunnerState.completed);
1859
+ }
1850
1860
  }
1851
1861
  } else {
1852
1862
  __privateGet(this, _warn).call(this, `#StartRunner:ExecuteLoop(): Cannot get execution profile for runner: [${runnerId}]`);