Sha256: 28c52e2096f1ae466d1a6ece9c265d740b605b15a25ecf1d361076218a176781

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

class Worker < ActiveRecord::Base
  class << self
    def prune
      delete_all(['last_seen_at < ?', Time.now - Travis.config.workers.prune.after])
    end
  end

  before_create do
    self.last_seen_at = Time.now
  end

  def full_name
    [host, name].join(':')
  end

  def ping!
    touch(:last_seen_at)
  end

  def set_state(state)
    update_attribute(:state, state)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-core-0.0.1 lib/travis/model/worker.rb