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 +9 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs +2 -0
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +2 -0
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2285,9 +2285,11 @@ function sha256(s) {
|
|
|
2285
2285
|
}
|
|
2286
2286
|
|
|
2287
2287
|
// src/server/runner/step.ts
|
|
2288
|
+
var DUE_SKEW_MS = 1e3;
|
|
2288
2289
|
async function processOneRunStep(runId, ctx) {
|
|
2289
2290
|
const run = await ctx.collections.flowRuns.findOne({ _id: runId });
|
|
2290
2291
|
if (!run || run.status !== "active") return;
|
|
2292
|
+
if (run.nextActionAt && run.nextActionAt.getTime() > Date.now() + DUE_SKEW_MS) return;
|
|
2291
2293
|
const flow = await ctx.collections.flows.findOne({ _id: run.flowId });
|
|
2292
2294
|
if (!flow) {
|
|
2293
2295
|
await failFlowRun(run, "flow_missing", ctx);
|
|
@@ -4814,7 +4816,7 @@ async function runSetupChecks(mailer) {
|
|
|
4814
4816
|
const checks = [];
|
|
4815
4817
|
checks.push(await checkMongo(mailer));
|
|
4816
4818
|
checks.push(await checkQueue(mailer));
|
|
4817
|
-
if (mailer.config.queue.driver !== "noop"
|
|
4819
|
+
if (mailer.config.queue.driver !== "noop") {
|
|
4818
4820
|
checks.push(await checkWorkersHeartbeat(mailer));
|
|
4819
4821
|
}
|
|
4820
4822
|
checks.push(await checkCircuitBreaker(mailer));
|
|
@@ -4879,13 +4881,14 @@ async function checkWorkersHeartbeat(mailer) {
|
|
|
4879
4881
|
);
|
|
4880
4882
|
const tickIntervalMs = mailer.config.tickIntervalSeconds * 1e3;
|
|
4881
4883
|
const staleAfterMs = Math.max(tickIntervalMs * 3, 3e4);
|
|
4884
|
+
const workerless = mailer.config.workerless;
|
|
4882
4885
|
if (!h) {
|
|
4883
4886
|
return {
|
|
4884
4887
|
name: "workers_heartbeat",
|
|
4885
4888
|
label: "Background workers",
|
|
4886
4889
|
severity: "warn",
|
|
4887
|
-
message: "no tick has run yet",
|
|
4888
|
-
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."
|
|
4890
|
+
message: workerless ? "no tick has run yet (workers run in another process)" : "no tick has run yet",
|
|
4891
|
+
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."
|
|
4889
4892
|
};
|
|
4890
4893
|
}
|
|
4891
4894
|
const ageMs = Date.now() - new Date(h.updatedAt).getTime();
|
|
@@ -4895,14 +4898,14 @@ async function checkWorkersHeartbeat(mailer) {
|
|
|
4895
4898
|
label: "Background workers",
|
|
4896
4899
|
severity: "error",
|
|
4897
4900
|
message: `last tick ${humanDuration(ageMs)} ago (expected within ${humanDuration(tickIntervalMs)})`,
|
|
4898
|
-
hint: "Workers appear to be down. Sends and flow advancement are halted. Restart your worker process (`mailer.startWorkers()`)."
|
|
4901
|
+
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()`)."
|
|
4899
4902
|
};
|
|
4900
4903
|
}
|
|
4901
4904
|
return {
|
|
4902
4905
|
name: "workers_heartbeat",
|
|
4903
4906
|
label: "Background workers",
|
|
4904
4907
|
severity: "ok",
|
|
4905
|
-
message: `last tick ${humanDuration(ageMs)} ago`
|
|
4908
|
+
message: `last tick ${humanDuration(ageMs)} ago${workerless ? " (worker process)" : ""}`
|
|
4906
4909
|
};
|
|
4907
4910
|
}
|
|
4908
4911
|
async function checkCircuitBreaker(mailer) {
|
|
@@ -7590,7 +7593,7 @@ var DEDUPE_POLICIES = [
|
|
|
7590
7593
|
];
|
|
7591
7594
|
|
|
7592
7595
|
// src/server/index.ts
|
|
7593
|
-
var VERSION = "0.10.
|
|
7596
|
+
var VERSION = "0.10.2" ;
|
|
7594
7597
|
|
|
7595
7598
|
export { DEDUPE_POLICIES, FLOW_STEP_KINDS, Mailer, MongoContactAdapter, NullProvider, PREDICATE_KINDS, RESERVED_VAR_KEYS, SEGMENT_FILTER_KINDS, SendGridProvider, VERSION, applyTracking, applyWebhookEvent, compileMailyTemplate, compileTemplate, computeDeliveryTime, createAdminRouter, createPublicRouter, defaultFlowStep, defaultPredicate, defaultSegmentFilter, defineVars, derivePlaintext, dispatchSend, ensureIndexes, getCollections, predicateKind, processNewlyFiredEventTriggers, processOneRunStep, renderTemplate, runTick, sha256Hex, signUnsubscribeToken, sweepStrandedFlowRuns, validateSenderDomain, varsJsonSchema, verifyUnsubscribeToken };
|
|
7596
7599
|
//# sourceMappingURL=index.js.map
|