Skip to content
Snippets Groups Projects
Commit 6b76c19b authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Merge branch 'fix/offline_runner_detection' into 'master'

Fix offline runner detection

See merge request !11751
parents 4e4154a9 eec8a0b1
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,7 +3,7 @@ module Ci
extend Ci::Model
 
RUNNER_QUEUE_EXPIRY_TIME = 60.minutes
LAST_CONTACT_TIME = 1.hour.ago
ONLINE_CONTACT_TIMEOUT = 1.hour
AVAILABLE_SCOPES = %w[specific shared active paused online].freeze
FORM_EDITABLE = %i[description tag_list active run_untagged locked].freeze
 
Loading
Loading
@@ -19,7 +19,7 @@ module Ci
scope :shared, ->() { where(is_shared: true) }
scope :active, ->() { where(active: true) }
scope :paused, ->() { where(active: false) }
scope :online, ->() { where('contacted_at > ?', LAST_CONTACT_TIME) }
scope :online, ->() { where('contacted_at > ?', contact_time_deadline) }
scope :ordered, ->() { order(id: :desc) }
 
scope :owned_or_shared, ->(project_id) do
Loading
Loading
@@ -59,6 +59,10 @@ module Ci
where(t[:token].matches(pattern).or(t[:description].matches(pattern)))
end
 
def self.contact_time_deadline
ONLINE_CONTACT_TIMEOUT.ago
end
def set_default_values
self.token = SecureRandom.hex(15) if self.token.blank?
end
Loading
Loading
@@ -80,7 +84,7 @@ module Ci
end
 
def online?
contacted_at && contacted_at > LAST_CONTACT_TIME
contacted_at && contacted_at > self.class.contact_time_deadline
end
 
def status
Loading
Loading
---
title: Fix offline runner detection
merge_request: 11751
author: Alessio Caiazza
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment