Class: Skiplock::Manager

Inherits:
Object
  • Object
show all
Defined in:
lib/skiplock/manager.rb

Defined Under Namespace

Classes: Demux

Class Method Summary collapse

Class Method Details

.shutdown(wait: true) ⇒ Object



15
16
17
18
19
20
# File 'lib/skiplock/manager.rb', line 15

def self.shutdown(wait: true)
  if @dispatcher && @thread
    @dispatcher.shutdown(wait: wait)
    @thread.join
  end
end

.start(standalone: false) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/skiplock/manager.rb', line 3

def self.start(standalone: false)
  load_settings
  return unless standalone || (caller.any?{|l| l =~ %r{/rack/}} && (Settings['workers'] == 0 || Rails.env.development?))
  if standalone
    self.standalone
  else
    @dispatcher = Dispatcher.new
    @thread = @dispatcher.run
    at_exit { self.shutdown }
  end
end