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, #inspect, #logger, #process_nonce, #redis, #safe_thread, #tid, #watchdog

Constructor Details

#initialize(config) ⇒ Embedded

Returns a new instance of Embedded.



11
12
13
# File 'lib/sidekiq/embedded.rb', line 11

def initialize(config)
  @config = config
end

Instance Method Details

#quietObject



26
27
28
# File 'lib/sidekiq/embedded.rb', line 26

def quiet
  @launcher&.quiet
end

#runObject



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

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



30
31
32
# File 'lib/sidekiq/embedded.rb', line 30

def stop
  @launcher&.stop
end