Sha256: c1cc182f830176627c632bcba20c222ad3363c51794c260cf4432c4d6ad77940

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

require 'belated'

module ActiveJob # :nodoc:
  module QueueAdapters # :nodoc:
    # The adapter in charge of handling ActiveJob integration.
    # WIP
    class BelatedAdapter
      def instance
        @instance ||= Belated::Client.instance
      rescue StandardError
        @instance = Belated::Client.new
      end

      def enqueue(job) # :nodoc:
        Rails.logger.info "Belated got job #{job}"
        instance.perform(job, active_job: true)
      end

      def enqueue_at(job, timestamp) # :nodoc:
        Rails.logger.info "Belated got job #{job} to be performed at #{Time.at(timestamp)}"
        instance.perform_belated(job, at: timestamp, active_job: true)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
belated-0.7.0 lib/active_job/queue_adapters/belated_adapter.rb