Sha256: 75f4e3a71daf53132f55a070293658413841053a6c81b913c536c4d8808085ee
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require_relative "client" module Litejob # Litejob::Concern is responsible for providing an interface to job classes module Concern def perform_async(*params) @litejob_options ||= {} client.push(name, params, @litejob_options.merge(delay: 0, queue: queue_name)) end def perform_at(time, *params) @litejob_options ||= {} delay = time.to_i - Time.now.to_i client.push(name, params, @litejob_options.merge(delay: delay, queue: queue_name)) end def perform_in(delay, *params) @litejob_options ||= {} client.push(name, params, @litejob_options.merge(delay: delay, queue: queue_name)) end alias_method :perform_after, :perform_in def delete(id) client.delete(id) end def queue_as(queue_name) @queue_name = queue_name.to_s end def litejob_options(options) @litejob_options = options end private def queue_name @queue_name || "default" end def client @client ||= Client.new end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
litejob-0.2.3 | lib/litejob/concern.rb |
litejob-0.2.2 | lib/litejob/concern.rb |