Class: PumaAutoTune::Worker

Inherits:
Object
  • Object
show all
Defined in:
lib/puma_auto_tune/worker.rb

Instance Method Summary collapse

Constructor Details

#initialize(worker) ⇒ Worker

Returns a new instance of Worker.



4
5
6
# File 'lib/puma_auto_tune/worker.rb', line 4

def initialize(worker)
  @worker = worker
end

Instance Method Details

#get_memoryObject



13
14
15
16
17
18
19
# File 'lib/puma_auto_tune/worker.rb', line 13

def get_memory
  @memory = if restarting?
    0
  else
    ::GetProcessMem.new(self.pid).mb
  end
end

#memoryObject Also known as: mb



8
9
10
# File 'lib/puma_auto_tune/worker.rb', line 8

def memory
  @memory || get_memory
end

#pidObject



31
32
33
# File 'lib/puma_auto_tune/worker.rb', line 31

def pid
  @worker.pid
end

#restartObject



26
27
28
29
# File 'lib/puma_auto_tune/worker.rb', line 26

def restart
  @restarting = true
  @worker.term
end

#restarting?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/puma_auto_tune/worker.rb', line 21

def restarting?
  @restarting
end