Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Commit b982e06

Browse files
authored
Merge pull request #64 from b0dea/revert-once-changes
2 parents c3f63fd + 78ba2c1 commit b982e06

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/job/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class Job<T extends JobAttributesData = JobAttributesData> {
186186
attrs: JobAttributes<T>;
187187

188188
constructor(options: Modify<JobAttributes<T>, { _id?: mongodb.ObjectId }>) {
189-
const { pulse, type, nextRunAt, repeatAt, repeatInterval, lastFinishedAt, ...args } = options ?? {};
189+
const { pulse, type, nextRunAt, ...args } = options ?? {};
190190

191191
// Save Pulse instance
192192
this.pulse = pulse;
@@ -211,7 +211,7 @@ class Job<T extends JobAttributesData = JobAttributesData> {
211211
...attrs,
212212
name: attrs.name || '',
213213
priority: attrs.priority,
214-
type: type || 'single',
214+
type: type || 'once',
215215
// if a job that's non-recurring has a lastFinishedAt (finished the job), do not default nextRunAt to now
216216
// only if it will be defaulted either by explicitly setting it or by computing it computeNextRunAt
217217
nextRunAt: nextRunAt || new Date(),

test/unit/pulse.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ describe('Test Pulse', () => {
233233

234234
test('should resume non-recurring jobs on restart', async () => {
235235
const job = globalPulseInstance.create('sendEmail', { to: 'user@example.com' });
236-
job.attrs.nextRunAt = new Date(Date.now() - 1000);
236+
job.attrs.nextRunAt = new Date(Date.now() - 2000);
237237
await job.save();
238238

239239
await globalPulseInstance.resumeOnRestart();

0 commit comments

Comments
 (0)