Method: Exekutor::Internal::CLI::Manager#start

Defined in:
lib/exekutor/internal/cli/manager.rb

#start(options) ⇒ Void

Starts a new worker

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :restart (Boolean)

    Whether the worker is being restarted

  • :daemonize (Boolean)

    Whether the worker should be daemonized

  • :environment (String)

    The Rails environment to load

  • :queue (String)

    The queue(s) to watch

  • :threads (String)

    The number of threads to use for job execution

  • :priority (String)

    The priorities to execute

  • :poll_interval (Integer)

    The interval in seconds for job polling

Returns:

  • (Void)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/exekutor/internal/cli/manager.rb', line 29

def start(options)
  Process.setproctitle "Exekutor worker (Initializing…) [#{$PROGRAM_NAME}]"
  daemonize(restarting: options[:restart]) if options[:daemonize]

  load_application(options[:environment])

  # Specify `yield: true` to prevent running in the context of the loaded module
  ActiveSupport.on_load(:exekutor, yield: true) do
    worker_options = worker_options(options[:configfile], cli_worker_overrides(options))

    ActiveSupport.on_load(:active_record, yield: true) do
      start_and_join_worker(worker_options, options[:daemonize])
    end
  end
end