Class: RailsFastCache::Scheduler

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-fast-cache/scheduler.rb

Constant Summary collapse

EXECUTOR_OPTIONS =
{
  min_threads: ENV.fetch('RAILS_MAX_THREADS', 3).to_i,
  max_threads: ENV.fetch('RAILS_MAX_THREADS', 3).to_i,
  max_queue: 100,
  fallback_policy: :caller_runs
}.freeze

Class Method Summary collapse

Class Method Details

.queue_adapterObject



12
13
14
# File 'lib/rails-fast-cache/scheduler.rb', line 12

def self.queue_adapter
  @queue_adapter ||= ActiveJob::QueueAdapters::AsyncAdapter.new(**EXECUTOR_OPTIONS)
end

.shutdownObject



16
17
18
# File 'lib/rails-fast-cache/scheduler.rb', line 16

def self.shutdown
  @queue_adapter&.shutdown(wait: true)
end