Sha256: d79917cb43463f958612601116b068b03c418a828e9536ad2e756e8878246f25

Contents?: true

Size: 464 Bytes

Versions: 1

Compression:

Stored size: 464 Bytes

Contents

module PumaAutoTune
  class Worker

    def initialize(worker)
      @worker = worker
    end

    def memory
      @memory || get_memory
    end
    alias :mb :memory

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

    def restarting?
      @restarting
    end


    def restart
      @restarting = true
      @worker.term
    end

    def pid
      @worker.pid
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puma_auto_tune-0.0.1 lib/puma_auto_tune/worker.rb