@peopl-health/nexus 5.54.0-dev.7843 → 5.54.0-dev.7844

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.
@@ -158,8 +158,6 @@ class WorkflowRunner {
158
158
 
159
159
  _arm(workflow, workId, delayMs) {
160
160
  const id = String(workId);
161
- // An attempt still in flight when stop() lands must not re-arm after shutdown. The
162
- // record stays pending in Mongo, so the next process recovers it on its sweep.
163
161
  if (this.stopped) return id;
164
162
  clearTimeout(this.timers.get(id));
165
163
  const timer = setTimeout(() => {
@@ -212,9 +210,6 @@ class WorkflowRunner {
212
210
  return { status: 'done' };
213
211
  }
214
212
 
215
- // matchedCount, not modifiedCount: the fence is "do we still hold the claim", and
216
- // modifiedCount is also 0 for a write that matched but set an identical value - a
217
- // save() rewriting an unchanged checkpoint is not a lost claim.
218
213
  async _write(work, claimedAt, $set) {
219
214
  const { matchedCount } = await DeferredWork.updateOne({ _id: work._id, claimedAt }, { $set });
220
215
  if (!matchedCount) logger.warn('[WorkflowRunner] Claim lost, write discarded', { deferredWorkId: String(work._id) });
@@ -222,9 +217,6 @@ class WorkflowRunner {
222
217
  }
223
218
 
224
219
  async _rescheduleOrAbandon(workflow, work, claimedAt, error) {
225
- // prepare() is consumer code and can throw anything, including null. Dereferencing
226
- // it here used to raise a TypeError out of this handler, so neither branch ran and
227
- // the record stayed `processing` until stale recovery hit the same failure again.
228
220
  const lastError = describeThrown(error);
229
221
  const delayMinutes = workflow.retrySchedule[work.attempt];
230
222
  if (error?.permanent === true || delayMinutes === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.54.0-dev.7843",
3
+ "version": "5.54.0-dev.7844",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",