| Class | Sidekiq::Cron::Job |
| In: |
lib/sidekiq/cron/job.rb
|
| Parent: | Object |
| REMEMBER_THRESHOLD | = | 24 * 60 * 60 | how long we would like to store informations about previous enqueues | |
| LAST_ENQUEUE_TIME_FORMAT | = | '%Y-%m-%d %H:%M:%S %z' |
| args | [RW] | |
| cron | [RW] | |
| description | [RW] | |
| fetch_missing_args | [R] | |
| klass | [RW] | |
| last_enqueue_time | [R] | |
| message | [RW] | |
| name | [RW] |
load cron jobs from Array input structure should look like: [
{
'name' => 'name_of_job',
'class' => 'MyClass',
'cron' => '1 * * * *',
'args' => '(OPTIONAL) [Array or Hash]',
'description' => '(OPTIONAL) Description of job'
},
{
'name' => 'Cool Job for Second Class',
'class' => 'SecondClass',
'cron' => '*/5 * * * *'
}
]
like to {load_from_array} If exists old jobs in redis but removed from args, destroy old jobs
load cron jobs from Hash input structure should look like: {
'name_of_job' => {
'class' => 'MyClass',
'cron' => '1 * * * *',
'args' => '(OPTIONAL) [Array or Hash]',
'description' => '(OPTIONAL) Description of job'
},
'My super iber cool job' => {
'class' => 'SecondClass',
'cron' => '*/5 * * * *'
}
}
like to {load_from_hash} If exists old jobs in redis but removed from args, destroy old jobs
active job has different structure how it is loading data from sidekiq queue, it createaswrapper arround job
remove job from cron jobs by name input:
first arg: name (string) - name of job (must be same - case sensitive)
remove previous informations about run times this will clear redis and make sure that redis will not overflow with memory
add job to cron jobs input:
name: (string) - name of job cron: (string: '* * * * *' - cron specification when to run job class: (string|class) - which class to perform
optional input:
queue: (string) - which queue to use for enquing (will override class queue) args: (array|hash|nil) - arguments for permorm method