2017-07-09 13:49:52 -04:00
|
|
|
# frozen_string_literal: true
|
2017-07-10 09:40:03 -04:00
|
|
|
|
2014-08-18 03:19:41 -04:00
|
|
|
class JobsManager
|
|
|
|
@@managers = {}
|
|
|
|
attr :adapter_name
|
|
|
|
|
|
|
|
def self.current_manager
|
2016-08-06 12:41:18 -04:00
|
|
|
@@managers[ENV["AJ_ADAPTER"]] ||= new(ENV["AJ_ADAPTER"])
|
2014-08-18 03:19:41 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(adapter_name)
|
|
|
|
@adapter_name = adapter_name
|
|
|
|
require_relative "adapters/#{adapter_name}"
|
|
|
|
extend "#{adapter_name.camelize}JobsManager".constantize
|
|
|
|
end
|
|
|
|
|
|
|
|
def setup
|
|
|
|
ActiveJob::Base.queue_adapter = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def clear_jobs
|
|
|
|
end
|
|
|
|
|
|
|
|
def start_workers
|
|
|
|
end
|
|
|
|
|
|
|
|
def stop_workers
|
|
|
|
end
|
|
|
|
end
|