mongo-job-scheduler 0.1.11 → 0.1.13
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/README.md
CHANGED
|
@@ -25,7 +25,7 @@ A production-grade MongoDB-backed job scheduler for Node.js with distributed loc
|
|
|
25
25
|
|
|
26
26
|
### Requirements
|
|
27
27
|
|
|
28
|
-
- Node.js >=
|
|
28
|
+
- Node.js >= 18.0.0
|
|
29
29
|
- MongoDB 5.0, 6.0, 7.0+
|
|
30
30
|
- The `mongodb` driver (v5, v6, or v7) must be installed as a peer dependency.
|
|
31
31
|
|
|
@@ -35,6 +35,14 @@ A production-grade MongoDB-backed job scheduler for Node.js with distributed loc
|
|
|
35
35
|
npm install mongo-job-scheduler
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
### UI Dashboard (Optional)
|
|
39
|
+
|
|
40
|
+
For a visual web dashboard to manage and monitor your jobs, check out:
|
|
41
|
+
|
|
42
|
+
- **NPM**: [`mongo-scheduler-ui`](https://www.npmjs.com/package/mongo-scheduler-ui)
|
|
43
|
+
- **GitHub**: [mongo-scheduler-ui](https://github.com/darshanpatel14/mongo-job-scheduler-ui)
|
|
44
|
+
- **API Server**: [mongo-job-scheduler-api](https://github.com/darshanpatel14/mongo-job-scheduler-api)
|
|
45
|
+
|
|
38
46
|
### Basic Usage
|
|
39
47
|
|
|
40
48
|
```typescript
|
|
@@ -252,26 +260,18 @@ Run **multiple scheduler instances** (different servers, pods, or processes) con
|
|
|
252
260
|
- **Concurrency Control** — only one worker executes a job instance
|
|
253
261
|
- **Horizontally Scalable** — supports MongoDB sharding
|
|
254
262
|
|
|
255
|
-
|
|
263
|
+
- **Horizontally Scalable** — supports MongoDB sharding
|
|
256
264
|
|
|
257
265
|
---
|
|
258
266
|
|
|
259
267
|
## Documentation
|
|
260
268
|
|
|
261
|
-
- **`architecture.md`** — Internal design, MongoDB schema, sharding strategy, production checklist
|
|
262
269
|
- **Job lifecycle** — pending → running → completed/failed
|
|
263
270
|
- **Retry & repeat semantics** — at-most-once guarantees
|
|
264
271
|
- **Correctness guarantees** — what we ensure and what we don't
|
|
265
272
|
|
|
266
273
|
---
|
|
267
274
|
|
|
268
|
-
## Status
|
|
269
|
-
|
|
270
|
-
**Early-stage but production-tested.**
|
|
271
|
-
API may evolve before 1.0.0.
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
275
|
## License
|
|
276
276
|
|
|
277
277
|
MIT
|
|
@@ -150,6 +150,9 @@ class InMemoryJobStore {
|
|
|
150
150
|
if (updates.status !== undefined) {
|
|
151
151
|
job.status = updates.status;
|
|
152
152
|
}
|
|
153
|
+
if (updates.attempts !== undefined) {
|
|
154
|
+
job.attempts = updates.attempts;
|
|
155
|
+
}
|
|
153
156
|
job.updatedAt = new Date();
|
|
154
157
|
}
|
|
155
158
|
async findAll(query) {
|
|
@@ -212,6 +212,8 @@ class MongoJobStore {
|
|
|
212
212
|
$set.repeat = updates.repeat;
|
|
213
213
|
if (updates.status !== undefined)
|
|
214
214
|
$set.status = updates.status;
|
|
215
|
+
if (updates.attempts !== undefined)
|
|
216
|
+
$set.attempts = updates.attempts;
|
|
215
217
|
await this.collection.updateOne({ _id: id }, { $set });
|
|
216
218
|
}
|
|
217
219
|
async findAll(query) {
|
package/dist/worker/worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mongo-job-scheduler",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Production-grade MongoDB-backed job scheduler with retries, cron, timezone support, and crash recovery",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Darshan Bhut",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": ">=18.0.0"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"job-scheduler",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"scheduler"
|
|
41
41
|
],
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "tsc",
|
|
43
|
+
"build": "tsc -p tsconfig.build.json",
|
|
44
44
|
"test": "jest",
|
|
45
45
|
"test:mongo": "jest tests/mongo",
|
|
46
46
|
"test:stress": "jest tests/stress",
|