Sha256: 6dc3bdfc0374293ab55f270d28b2c85e1cf1970f368a14ee0c18ba3b1db5a376

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

module GoodJob
  class Adapter
    def initialize(inline: false)
      @inline = inline
    end

    def enqueue(active_job)
      enqueue_at(active_job, nil)
    end

    def enqueue_at(active_job, timestamp)
      good_job = GoodJob::Job.enqueue(
        active_job,
        scheduled_at: timestamp ? Time.at(timestamp) : nil,
        create_with_advisory_lock: inline?
      )

      if inline?
        good_job.perform
        good_job.advisory_unlock
      end

      good_job
    end

    def shutdown(wait: true) # rubocop:disable Lint/UnusedMethodArgument
      nil
    end

    def inline?
      @inline
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
good_job-0.5.0 lib/good_job/adapter.rb