mirror of
https://github.com/plashchynski/crono.git
synced 2026-04-24 09:48:39 +02:00
Add ability to define minimal time between job executions to support multiple corno nodes, so two different nodes will not execute the same job
This commit is contained in:
@@ -36,6 +36,32 @@ describe Crono::Job do
|
||||
failing_job.perform.join
|
||||
expect(failing_job.healthy).to be false
|
||||
end
|
||||
|
||||
it 'should execute one' do
|
||||
job.execution_interval = 5.minutes
|
||||
|
||||
expect(job).to receive(:perform_job).once
|
||||
job.perform.join
|
||||
thread = job.perform.join
|
||||
expect(thread).to be_stop
|
||||
end
|
||||
|
||||
it 'should execute twice' do
|
||||
job.execution_interval = 0.minutes
|
||||
|
||||
test_preform_job_twice
|
||||
end
|
||||
|
||||
it 'should execute twice without initialize execution_interval' do
|
||||
test_preform_job_twice
|
||||
end
|
||||
|
||||
def test_preform_job_twice
|
||||
expect(job).to receive(:perform_job).twice
|
||||
job.perform.join
|
||||
thread = job.perform.join
|
||||
expect(thread).to be_stop
|
||||
end
|
||||
end
|
||||
|
||||
describe '#description' do
|
||||
|
||||
Reference in New Issue
Block a user