mailery 0.10.0 → 0.10.2

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.
package/dist/index.cjs CHANGED
@@ -2303,9 +2303,11 @@ function sha256(s) {
2303
2303
  }
2304
2304
 
2305
2305
  // src/server/runner/step.ts
2306
+ var DUE_SKEW_MS = 1e3;
2306
2307
  async function processOneRunStep(runId, ctx) {
2307
2308
  const run = await ctx.collections.flowRuns.findOne({ _id: runId });
2308
2309
  if (!run || run.status !== "active") return;
2310
+ if (run.nextActionAt && run.nextActionAt.getTime() > Date.now() + DUE_SKEW_MS) return;
2309
2311
  const flow = await ctx.collections.flows.findOne({ _id: run.flowId });
2310
2312
  if (!flow) {
2311
2313
  await failFlowRun(run, "flow_missing", ctx);
@@ -4832,7 +4834,7 @@ async function runSetupChecks(mailer) {
4832
4834
  const checks = [];
4833
4835
  checks.push(await checkMongo(mailer));
4834
4836
  checks.push(await checkQueue(mailer));
4835
- if (mailer.config.queue.driver !== "noop" && !mailer.config.workerless) {
4837
+ if (mailer.config.queue.driver !== "noop") {
4836
4838
  checks.push(await checkWorkersHeartbeat(mailer));
4837
4839
  }
4838
4840
  checks.push(await checkCircuitBreaker(mailer));
@@ -4897,13 +4899,14 @@ async function checkWorkersHeartbeat(mailer) {
4897
4899
  );
4898
4900
  const tickIntervalMs = mailer.config.tickIntervalSeconds * 1e3;
4899
4901
  const staleAfterMs = Math.max(tickIntervalMs * 3, 3e4);
4902
+ const workerless = mailer.config.workerless;
4900
4903
  if (!h) {
4901
4904
  return {
4902
4905
  name: "workers_heartbeat",
4903
4906
  label: "Background workers",
4904
4907
  severity: "warn",
4905
- message: "no tick has run yet",
4906
- hint: "If your separate worker process is started, the heartbeat will appear within one tick interval. If you forgot to run `mailer.startWorkers()`, sends will sit queued indefinitely."
4908
+ message: workerless ? "no tick has run yet (workers run in another process)" : "no tick has run yet",
4909
+ hint: workerless ? "This process is workerless; the heartbeat comes from your separate worker process. If that process is started, the heartbeat will appear within one tick interval \u2014 a fresh install legitimately has none yet." : "If your separate worker process is started, the heartbeat will appear within one tick interval. If you forgot to run `mailer.startWorkers()`, sends will sit queued indefinitely."
4907
4910
  };
4908
4911
  }
4909
4912
  const ageMs = Date.now() - new Date(h.updatedAt).getTime();
@@ -4913,14 +4916,14 @@ async function checkWorkersHeartbeat(mailer) {
4913
4916
  label: "Background workers",
4914
4917
  severity: "error",
4915
4918
  message: `last tick ${humanDuration(ageMs)} ago (expected within ${humanDuration(tickIntervalMs)})`,
4916
- hint: "Workers appear to be down. Sends and flow advancement are halted. Restart your worker process (`mailer.startWorkers()`)."
4919
+ hint: workerless ? "Workers run in another process, and that process appears to be down. Sends and flow advancement are halted. Restart the process that calls `mailer.startWorkers()`." : "Workers appear to be down. Sends and flow advancement are halted. Restart your worker process (`mailer.startWorkers()`)."
4917
4920
  };
4918
4921
  }
4919
4922
  return {
4920
4923
  name: "workers_heartbeat",
4921
4924
  label: "Background workers",
4922
4925
  severity: "ok",
4923
- message: `last tick ${humanDuration(ageMs)} ago`
4926
+ message: `last tick ${humanDuration(ageMs)} ago${workerless ? " (worker process)" : ""}`
4924
4927
  };
4925
4928
  }
4926
4929
  async function checkCircuitBreaker(mailer) {
@@ -7608,7 +7611,7 @@ var DEDUPE_POLICIES = [
7608
7611
  ];
7609
7612
 
7610
7613
  // src/server/index.ts
7611
- var VERSION = "0.10.0" ;
7614
+ var VERSION = "0.10.2" ;
7612
7615
 
7613
7616
  exports.DEDUPE_POLICIES = DEDUPE_POLICIES;
7614
7617
  exports.FLOW_STEP_KINDS = FLOW_STEP_KINDS;