@nextnode-solutions/nn 1.1.5 → 1.1.6

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -13
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20786,24 +20786,23 @@ function gracefulKill(proc, timeoutMs = 5e3) {
20786
20786
  });
20787
20787
  }
20788
20788
  async function waitForHealthy(checkFn, label, maxMs = 6e4) {
20789
- let delay = 500;
20790
- let elapsed = 0;
20791
- let lastLog = 0;
20792
- while (elapsed < maxMs) {
20789
+ const start = Date.now();
20790
+ let nextLog = start;
20791
+ consola.info(`Waiting for ${label} to become healthy...`);
20792
+ while (Date.now() - start < maxMs) {
20793
20793
  if (checkFn()) {
20794
20794
  consola.success(`${label} healthy`);
20795
20795
  return true;
20796
20796
  }
20797
- if (elapsed - lastLog >= 1e4) {
20798
- const remaining = Math.ceil((maxMs - elapsed) / 1e3);
20797
+ const now = Date.now();
20798
+ if (now >= nextLog) {
20799
+ const remaining = Math.ceil((maxMs - (now - start)) / 1e3);
20799
20800
  consola.info(
20800
- `Waiting for ${label} to become healthy... (${remaining}s remaining)`
20801
+ `Still waiting for ${label}... (${remaining}s remaining)`
20801
20802
  );
20802
- lastLog = elapsed;
20803
+ nextLog = now + 1e4;
20803
20804
  }
20804
- await sleep(delay);
20805
- elapsed += delay;
20806
- delay = Math.min(delay * 2, 4e3);
20805
+ await sleep(2e3);
20807
20806
  }
20808
20807
  consola.warn(`${label} did not become healthy within ${maxMs / 1e3}s`);
20809
20808
  return false;
@@ -20913,9 +20912,15 @@ function ensureGitignore(projectDir) {
20913
20912
  function allServicesHealthy(composePath) {
20914
20913
  const statuses = getServiceStatuses(composePath);
20915
20914
  if (statuses.length === 0) return false;
20916
- return statuses.every(
20917
- (s2) => s2.state === "running" && (s2.health === "" || s2.health === "healthy")
20915
+ const unhealthy = statuses.filter(
20916
+ (s2) => s2.state !== "running" || s2.health !== "" && s2.health !== "healthy"
20918
20917
  );
20918
+ if (unhealthy.length > 0) {
20919
+ consola.debug(
20920
+ `Not ready: ${unhealthy.map((s2) => `${s2.name}(state=${s2.state},health=${s2.health})`).join(", ")}`
20921
+ );
20922
+ }
20923
+ return unhealthy.length === 0;
20919
20924
  }
20920
20925
  function printStartupSummary(composePath, services, ports) {
20921
20926
  console.log("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextnode-solutions/nn",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "files": [
5
5
  "dist"
6
6
  ],