Class: Exekutor::Info::Worker

Inherits:
Exekutor::Internal::BaseRecord show all
Defined in:
lib/exekutor/info/worker.rb

Overview

Active record class for a worker instance

Instance Method Summary collapse

Instance Method Details

#heartbeat!Object

Registers a heartbeat for this worker, if necessary



14
15
16
17
# File 'lib/exekutor/info/worker.rb', line 14

def heartbeat!
  now = Time.current.change(sec: 0)
  touch :last_heartbeat_at, time: now if last_heartbeat_at.nil? || now >= last_heartbeat_at + 1.minute
end