Class: Worker

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/travis/model/worker.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.pruneObject



3
4
5
# File 'lib/travis/model/worker.rb', line 3

def prune
  delete_all(['last_seen_at < ?', Time.now - Travis.config.workers.prune.after])
end

Instance Method Details

#full_nameObject



12
13
14
# File 'lib/travis/model/worker.rb', line 12

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

#ping!Object



16
17
18
# File 'lib/travis/model/worker.rb', line 16

def ping!
  touch(:last_seen_at)
end

#set_state(state) ⇒ Object



20
21
22
# File 'lib/travis/model/worker.rb', line 20

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