@pulsecron/pulse
Advanced tools
Comparing version 1.5.2 to 1.6.0
@@ -31,2 +31,3 @@ import * as mongodb from 'mongodb'; | ||
disabled?: boolean; | ||
progress?: number; | ||
nextRunAt?: Date | null; | ||
@@ -33,0 +34,0 @@ lockedAt?: Date | null; |
import { Job } from '.'; | ||
export type TouchMethod = () => Promise<Job>; | ||
export type TouchMethod = (progress?: number) => Promise<Job>; | ||
export declare const touch: TouchMethod; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.touch = void 0; | ||
const touch = async function () { | ||
const utils_1 = require("src/utils"); | ||
const touch = async function (progress) { | ||
if (progress && (progress < 0 || progress > 100)) { | ||
throw new utils_1.JobError('Progress must be a number between 0 and 100'); | ||
} | ||
this.attrs.lockedAt = new Date(); | ||
this.attrs.progress = progress; | ||
return this.save(); | ||
@@ -7,0 +12,0 @@ }; |
{ | ||
"name": "@pulsecron/pulse", | ||
"version": "1.5.2", | ||
"version": "1.6.0", | ||
"description": "The modern MongoDB-powered job scheduler library for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -153,3 +153,3 @@ <p align="center"> | ||
| [schedule.ts](https://github.com/pulsecron/pulse/blob/master/src/job/schedule.ts) | Schedule.ts in the job directory empowers a certain task to run at a predefined time. Using this feature, users can set either a specific date or a string pattern to determine the next execution instance of a job, thereby enhancing the scheduling capabilities in the overall Pulse project. | | ||
| [touch.ts](https://github.com/pulsecron/pulse/blob/master/src/job/touch.ts) | Touch.ts within the job directory of the Pulse repository manages job concurrency. It updates a jobs lockedAt time, preventing multiple instances from running simultaneously. The function returns a Promise for the saved job. | | ||
| [touch.ts](https://github.com/pulsecron/pulse/blob/master/src/job/touch.ts) | Touch.ts within the job directory of the Pulse repository manages job concurrency. It updates a jobs lockedAt time, preventing multiple instances from running simultaneously. Can have an optional progress parameter (0-100). The function returns a Promise for the saved job. | | ||
| [compute-next-run-at.ts](https://github.com/pulsecron/pulse/blob/master/src/job/compute-next-run-at.ts) | <code>► INSERT-TEXT-HERE</code> | | ||
@@ -156,0 +156,0 @@ | [to-json.ts](https://github.com/pulsecron/pulse/blob/master/src/job/to-json.ts) | Transforms job details into a storable JSON object within the repositorys job management module. Converts key date attributes into the Date data type, facilitating data interchange with MongoDB. | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
185871
2202