20 lines
484 B
Ruby
20 lines
484 B
Ruby
class StatusUpdateJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform
|
|
Server.active.find_each do |server|
|
|
health_status = L4dServer::HealthChecker.check(server)
|
|
|
|
server.update(last_health_check_at: Time.current)
|
|
|
|
case health_status
|
|
when :running
|
|
server.update(status: :running) if server.starting?
|
|
when :stopped
|
|
server.update(status: :stopped)
|
|
when :failed
|
|
server.update(status: :failed)
|
|
end
|
|
end
|
|
end
|
|
end
|