@monque/core 1.5.0 → 1.5.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monque/core",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "MongoDB-backed job scheduler with atomic locking, exponential backoff, and cron scheduling",
5
5
  "author": "Maurice de Bruyn <debruyn.maurice@gmail.com>",
6
6
  "repository": {
@@ -78,11 +78,11 @@
78
78
  "@faker-js/faker": "^10.3.0",
79
79
  "@testcontainers/mongodb": "^11.12.0",
80
80
  "@total-typescript/ts-reset": "^0.6.1",
81
- "@types/node": "^22.19.13",
81
+ "@types/node": "^22.19.15",
82
82
  "@vitest/coverage-v8": "^4.0.18",
83
83
  "fishery": "^2.4.0",
84
84
  "mongodb": "^7.1.0",
85
- "tsdown": "^0.20.3",
85
+ "tsdown": "^0.21.0",
86
86
  "vitest": "^4.0.18"
87
87
  }
88
88
  }
@@ -1074,6 +1074,11 @@ export class Monque extends EventEmitter {
1074
1074
  return;
1075
1075
  }
1076
1076
 
1077
+ // Stop all lifecycle timers FIRST to prevent new poll callbacks
1078
+ // This closes the race window where a queued poll tick could
1079
+ // check isRunning before the flag is set to false
1080
+ this.lifecycleManager.stopTimers();
1081
+
1077
1082
  this.isRunning = false;
1078
1083
 
1079
1084
  // Clear stats cache for clean state on restart
@@ -1086,9 +1091,6 @@ export class Monque extends EventEmitter {
1086
1091
  // ignore errors during shutdown cleanup
1087
1092
  }
1088
1093
 
1089
- // Stop all lifecycle timers
1090
- this.lifecycleManager.stopTimers();
1091
-
1092
1094
  // Wait for all active jobs to complete (with timeout)
1093
1095
  const activeJobs = this.getActiveJobs();
1094
1096
  if (activeJobs.length === 0) {