class Aws::Rails::Middleware::ElasticBeanstalkSQSD

def init_executor

def init_executor
  threads = Integer(ENV.fetch('AWS_PROCESS_BEANSTALK_WORKER_THREADS',
                              Concurrent.available_processor_count || Concurrent.processor_count))
  options = {
    max_threads: threads,
    max_queue: 1,
    auto_terminate: false, # register our own at_exit to gracefully shutdown
    fallback_policy: :abort # Concurrent::RejectedExecutionError must be handled
  }
  at_exit { shutdown }
  Concurrent::ThreadPoolExecutor.new(options)
end