BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3be6f68a
Unverified
Commit
3be6f68a
authored
Jan 29, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Ci::Runner#online? slightly more performant
This is a small refactor to avoid querying Redis when we know there's nothing in it.
parent
b88103e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
1 deletion
+3
-1
runner.rb
app/models/ci/runner.rb
+1
-1
runner_spec.rb
spec/models/ci/runner_spec.rb
+2
-0
No files found.
app/models/ci/runner.rb
View file @
3be6f68a
...
...
@@ -97,7 +97,7 @@ module Ci
end
def
online?
c
ached_c
ontacted_at
&&
cached_contacted_at
>
self
.
class
.
contact_time_deadline
contacted_at
&&
cached_contacted_at
>
self
.
class
.
contact_time_deadline
end
def
status
...
...
spec/models/ci/runner_spec.rb
View file @
3be6f68a
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment