Skip to content

Commit

Permalink
fix: return resolve pulse.stop() case of success (#18)
Browse files Browse the repository at this point in the history
* fix: return resolve pulse.stop() case of success
  • Loading branch information
code-xhyun authored May 2, 2024
1 parent c7a3531 commit df7e6f4
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/pulse/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ export const stop: StopMethod = async function (this: Pulse) {
}

debug('about to unlock jobs with ids: %O', jobIds);
this._collection.updateMany({ _id: { $in: jobIds } }, { $set: { lockedAt: null } }).catch((error) => {
if (error) {
reject(error);
}
this._collection
.updateMany({ _id: { $in: jobIds } }, { $set: { lockedAt: null } })
.then(() => {
this._lockedJobs = [];
return resolve();
})
.catch((error) => {
if (error) {
return reject(error);
}

this._lockedJobs = [];
resolve();
});
this._lockedJobs = [];
return resolve();
});
});
};

Expand Down

0 comments on commit df7e6f4

Please sign in to comment.