Module: EQ::Working

Defined in:
lib/eq-working.rb,
lib/eq-working/worker.rb

Defined Under Namespace

Classes: Worker

Constant Summary collapse

EQ_WORKER =
:_eq_working

Class Method Summary collapse

Class Method Details

.bootObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/eq-working.rb', line 9

def boot
  pool_size =EQ.config.worker_pool_size
  case pool_size
  when 0
    puts "pool empty"
  when 1
    EQ::Working::Worker.supervise_as EQ_WORKER
  else
    Celluloid::Actor[EQ_WORKER] = EQ::Working::Worker.pool size: pool_size
  end
end

.pool_sizeObject



29
30
31
# File 'lib/eq-working.rb', line 29

def pool_size
  EQ.config.worker_pool_size
end

.shutdownObject



21
22
23
# File 'lib/eq-working.rb', line 21

def shutdown
  worker.terminate! if worker
end

.workerObject



25
26
27
# File 'lib/eq-working.rb', line 25

def worker
  Celluloid::Actor[EQ_WORKER]
end