class Litejob::Server
def initialize(queues = ["default"])
def initialize(queues = ["default"]) @queue = Litequeue.instance @scheduler = Litescheduler.instance @queues = queues # group and order queues according to their priority @prioritized_queues = queues.each_with_object({}) do |(name, priority, spawns), memo| priority ||= 5 memo[priority] ||= [] memo[priority] << [name, spawns == "spawn"] end.sort_by do |priority, _| -priority end @running = true @sleep_intervals = [0.001, 0.005, 0.025, 0.125, 0.625, 1.0, 2.0] run! end