summaryrefslogtreecommitdiff
path: root/app/models/ci
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-01-29 00:25:13 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-01-29 00:25:13 +0100
commit0be8b3cdf677f8b20be820ad3f6fdd4b9b08fc56 (patch)
tree5294e50daec7bcee0c8b54ebac6d656ab8e414ec /app/models/ci
parentb1c40590e7738a782d1295d743a6a3957723c4b3 (diff)
downloadgitlab-ce-0be8b3cdf677f8b20be820ad3f6fdd4b9b08fc56.tar.gz
Check cache in Ci::Runner#online?
Diffstat (limited to 'app/models/ci')
-rw-r--r--app/models/ci/runner.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index dcbb397fb78..7e616ee9144 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -88,7 +88,10 @@ module Ci
end
def online?
- contacted_at && contacted_at > self.class.contact_time_deadline
+ Gitlab::Redis::SharedState.with do |redis|
+ last_seen = redis.get("#{self.runner_info_key}:contacted_at") || contacted_at
+ last_seen && last_seen > self.class.contact_time_deadline
+ end
end
def status
@@ -152,6 +155,10 @@ module Ci
ensure_runner_queue_value == value if value.present?
end
+ def runner_info_key
+ "runner:info:#{self.id}"
+ end
+
private
def cleanup_runner_queue