summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/ci/runner.rb2
-rw-r--r--spec/models/ci/runner_spec.rb2
2 files changed, 3 insertions, 1 deletions
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index 7cf36c0bfe0..f6d51fabd69 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -97,7 +97,7 @@ module Ci
end
def online?
- cached_contacted_at && cached_contacted_at > self.class.contact_time_deadline
+ contacted_at && cached_contacted_at > self.class.contact_time_deadline
end
def status
diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb
index 14747a23c82..99b4a82da88 100644
--- a/spec/models/ci/runner_spec.rb
+++ b/spec/models/ci/runner_spec.rb
@@ -128,6 +128,7 @@ describe Ci::Runner do
context 'with cache value' do
context 'contacted long time ago time' do
before do
+ runner.contacted_at = 1.year.ago
stub_redis_runner_contacted_at(1.year.ago.to_s)
end
@@ -136,6 +137,7 @@ describe Ci::Runner do
context 'contacted 1s ago' do
before do
+ runner.contacted_at = 50.minutes.ago
stub_redis_runner_contacted_at(1.second.ago.to_s)
end