2019-04-30 08:27:42 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-02-14 09:22:40 +08:00
|
|
|
RSpec.describe Sidekiq::Pausable do
|
2023-01-09 19:18:21 +08:00
|
|
|
after { Sidekiq.unpause_all! }
|
2019-02-14 09:22:40 +08:00
|
|
|
|
|
|
|
it "can still run heartbeats when paused" do
|
|
|
|
Sidekiq.pause!
|
|
|
|
|
|
|
|
freeze_time 1.week.from_now
|
|
|
|
|
|
|
|
jobs = Sidekiq::ScheduledSet.new
|
|
|
|
jobs.clear
|
|
|
|
middleware = Sidekiq::Pausable.new
|
|
|
|
|
2023-01-09 19:18:21 +08:00
|
|
|
middleware.call(Jobs::RunHeartbeat.new, { "args" => [{}] }, "critical") { "done" }
|
2019-02-14 09:22:40 +08:00
|
|
|
|
|
|
|
jobs = Sidekiq::ScheduledSet.new
|
|
|
|
expect(jobs.size).to eq(0)
|
|
|
|
end
|
|
|
|
end
|