class Trident::Worker

@param [Integer] pid - pid of the worker process @param [Trident::Pool] pool - pool managing the worker process.

Public Instance Methods

created_at() click to toggle source

We determine the time that this worker was created from the creation timestamp on its pidfile

# File lib/trident/worker.rb, line 22
def created_at
  @created_at ||= File.stat(path).ctime
end
destroy() click to toggle source

Remove the pidfile associated with this worker

# File lib/trident/worker.rb, line 15
def destroy
  FileUtils.rm path if File.exists?(path)
end
save() click to toggle source

we may track it

# File lib/trident/worker.rb, line 7
def save
  File.open(path, 'w') do |f|
    f << "#{pid}"
  end
end

Protected Instance Methods

path() click to toggle source

Path to this worker's pid file

# File lib/trident/worker.rb, line 29
def path
  File.join(pool.orphans_dir, "#{pid}.pid")
end