Skip to content

Commit

Permalink
fix #2
Browse files Browse the repository at this point in the history
  • Loading branch information
miaowing committed Aug 29, 2018
1 parent 07e543a commit 6cc9d9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/NestDistributedSchedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ export abstract class NestDistributedSchedule {
if (this.jobs) {
this.jobs.forEach(async job => {
if (job.cron) {
job = schedule.scheduleJob({
const _job = schedule.scheduleJob({
startTime: job.startTime,
endTime: job.endTime,
rule: job.cron
}, async () => {
try {
const release = await this.do(this.tryLock(job.key));
const result = await this.do(this[job.key]());
if (result && job) {
job.cancel();
if (result && _job) {
_job.cancel();
}
typeof release === "function" ? release() : void 0;
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nest-schedule",
"version": "0.3.0",
"version": "0.3.1",
"description": "Nest - modern, fast, powerful node.js web framework (@schedule)",
"author": "Miaowing <[email protected]>",
"license": "MIT",
Expand Down

0 comments on commit 6cc9d9b

Please sign in to comment.