aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/support/integration/adapters/resque.rb
blob: b9811bd3e1497da14285df3d1ecaf2702463a5e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module ResqueJobsManager
  def clear_jobs
    Resque.queues.each { |queue_name| Resque.redis.del "queue:#{queue_name}" }
    Resque.redis.keys("delayed:*").each  { |key| Resque.redis.del "#{key}" }
    Resque.redis.del "delayed_queue_schedule"
  end

  def start_workers
    @thread = Thread.new do
      Resque::Worker.new("*").work(0.5)
    end
  end

  def stop_workers
    @thread.kill
  end
end