Class: Sidekiq::Embedded

Inherits:
Object
  • Object
show all
Includes:
Component
Defined in:
lib/sidekiq/embedded.rb

Instance Attribute Summary

Attributes included from Component

#config

Instance Method Summary collapse

Methods included from Component

#fire_event, #handle_exception, #hostname, #identity, #logger, #process_nonce, #redis, #safe_thread, #tid, #watchdog

Constructor Details

#initialize(config) ⇒ Embedded

Returns a new instance of Embedded.



9
10
11
# File 'lib/sidekiq/embedded.rb', line 9

def initialize(config)
  @config = config
end

Instance Method Details

#quietObject



24
25
26
# File 'lib/sidekiq/embedded.rb', line 24

def quiet
  @launcher&.quiet
end

#runObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/sidekiq/embedded.rb', line 13

def run
  housekeeping
  fire_event(:startup, reverse: false, reraise: true)
  @launcher = Sidekiq::Launcher.new(@config, embedded: true)
  @launcher.run
  sleep 0.2 # pause to give threads time to spin up

  logger.info "Sidekiq running embedded, total process thread count: #{Thread.list.size}"
  logger.debug { Thread.list.map(&:name) }
end

#stopObject



28
29
30
# File 'lib/sidekiq/embedded.rb', line 28

def stop
  @launcher&.stop
end