Sha256: fb2d03ea92ed38ab0e3b3140b89237a2864c5bd86def82dca9c3e9571c486081

Contents?: true

Size: 1.33 KB

Versions: 13

Compression:

Stored size: 1.33 KB

Contents

require 'logger'
require "queue_classic"

require "queue_classic_plus/version"
require "queue_classic_plus/inheritable_attr"
require "queue_classic_plus/inflector"
require "queue_classic_plus/metrics"
require "queue_classic_plus/update_metrics"
require "queue_classic_plus/base"
require "queue_classic_plus/worker"
require "queue_classic_plus/queue_classic/queue"

module QueueClassicPlus
  require 'queue_classic_plus/railtie' if defined?(Rails)

  def self.migrate(c = QC::default_conn_adapter.connection)
    conn = QC::ConnAdapter.new(connection: c)
    conn.execute("ALTER TABLE queue_classic_jobs ADD COLUMN last_error TEXT")
    conn.execute("ALTER TABLE queue_classic_jobs ADD COLUMN remaining_retries INTEGER")
  end

  def self.demigrate(c = QC::default_conn_adapter.connection)
    conn = QC::ConnAdapter.new(connection: c)
    conn.execute("ALTER TABLE queue_classic_jobs DROP COLUMN last_error")
    conn.execute("ALTER TABLE queue_classic_jobs DROP COLUMN remaining_retries")
  end

  def self.exception_handler
    @exception_handler ||= ->(exception, job) { nil }
  end

  def self.exception_handler=(handler)
    @exception_handler = handler
  end

  def self.update_metrics
    UpdateMetrics.update
  end

  def self.logger
    @logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
  end

  def self.logger=(l)
    @logger = l
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
queue_classic_plus-4.0.0.alpha21 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha20 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha19 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha18 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha16 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha15 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha14 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha13 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha12 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha11 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha10 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha9 lib/queue_classic_plus.rb
queue_classic_plus-4.0.0.alpha8 lib/queue_classic_plus.rb