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:
avi_alima
2015-08-19 18:08:48 +03:00
parent f76dff32e4
commit 32bdba3244
6 changed files with 61 additions and 4 deletions

View File

@@ -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