new Job(args)
Parameters:
Name | Type | Description |
---|---|---|
args |
Object |
Job Options |
Properties:
Name | Type | Description |
---|---|---|
agenda |
Object |
The Agenda instance |
attrs |
Object |
- Source:
Methods
computeNextRunAt()
Internal method used to compute next time a job should run and sets the proper values
- Source:
disable()
Prevents the job type from running
- Source:
enable()
Allows job type to run
- Source:
fail(reason)
Fails the job with a reason (error) specified
Parameters:
Name | Type | Description |
---|---|---|
reason |
reason job failed |
- Source:
isRunning()
A job is running if: (lastRunAt exists AND lastFinishedAt does not exist) OR (lastRunAt exists AND lastFinishedAt exists but the lastRunAt is newer [in time] than lastFinishedAt)
- Source:
remove()
Remove the job from MongoDB
- Source:
repeatAt(time)
Sets a job to repeat at a specific time
Parameters:
Name | Type | Description |
---|---|---|
time |
time to repeat job at (human readable or number) |
- Source:
repeatEvery(interval, options)
Sets a job to repeat every X amount of time
Parameters:
Name | Type | Description |
---|---|---|
interval |
repeat every X |
|
options |
options to use for job |
- Source:
run()
Internal method (RUN)
- Source:
schedule(time)
Schedules a job to run at specified time
Parameters:
Name | Type | Description |
---|---|---|
time |
schedule a job to run "then" |
- Source:
toJSON()
Given a job, turn it into an object we can store in Mongo
- Source:
touch()
Updates "lockedAt" time so the job does not get picked up again
- Source:
unique(unique, opts)
Data to ensure is unique for job to be created
Parameters:
Name | Type | Description |
---|---|---|
unique |
mongo data query for unique |
|
opts |
unique options |
- Source: