Sha256: 384a44476d1dc6ac7f9ab298efb253cf8ce206a6388bafa124a539a57de4b96c
Contents?: true
Size: 895 Bytes
Versions: 3
Compression:
Stored size: 895 Bytes
Contents
# vim:fileencoding=utf-8 require_relative 'test_helper' context 'Multi Process' do test 'setting schedule= from many process does not corrupt the schedules' do schedules = {} counts = [] threads = [] # This number may need to be increased if this test is not failing processes = 20 schedule_count = 200 schedule_count.times do |n| schedules["job #{n}"] = { cron: '0 1 0 0 0' } end processes.times do |n| threads << Thread.new do sleep n * 0.1 Resque.schedule = schedules counts << Resque.schedule.size end end # doing this outside the threads increases the odds of failure Resque.schedule = schedules counts << Resque.schedule.size threads.each(&:join) counts.each_with_index do |c, i| assert_equal schedule_count, c, "schedule count is incorrect (c: #{i})" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
resque-scheduler-4.1.0 | test/multi_process_test.rb |
resque-scheduler-4.0.0 | test/multi_process_test.rb |
resque-scheduler-3.1.0 | test/multi_process_test.rb |