Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
eec8a0b1
Commit
eec8a0b1
authored
May 27, 2017
by
Alessio Caiazza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix offline runner detection
parent
6c15905c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
app/models/ci/runner.rb
app/models/ci/runner.rb
+7
-3
changelogs/unreleased/fix-runner_online_check.yml
changelogs/unreleased/fix-runner_online_check.yml
+4
-0
No files found.
app/models/ci/runner.rb
View file @
eec8a0b1
...
@@ -3,7 +3,7 @@ module Ci
...
@@ -3,7 +3,7 @@ module Ci
extend
Ci
::
Model
extend
Ci
::
Model
RUNNER_QUEUE_EXPIRY_TIME
=
60
.
minutes
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
AVAILABLE_SCOPES
=
%w[specific shared active paused online]
.
freeze
FORM_EDITABLE
=
%i[description tag_list active run_untagged locked]
.
freeze
FORM_EDITABLE
=
%i[description tag_list active run_untagged locked]
.
freeze
...
@@ -19,7 +19,7 @@ module Ci
...
@@ -19,7 +19,7 @@ module Ci
scope
:shared
,
->
()
{
where
(
is_shared:
true
)
}
scope
:shared
,
->
()
{
where
(
is_shared:
true
)
}
scope
:active
,
->
()
{
where
(
active:
true
)
}
scope
:active
,
->
()
{
where
(
active:
true
)
}
scope
:paused
,
->
()
{
where
(
active:
false
)
}
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
:ordered
,
->
()
{
order
(
id: :desc
)
}
scope
:owned_or_shared
,
->
(
project_id
)
do
scope
:owned_or_shared
,
->
(
project_id
)
do
...
@@ -59,6 +59,10 @@ module Ci
...
@@ -59,6 +59,10 @@ module Ci
where
(
t
[
:token
].
matches
(
pattern
).
or
(
t
[
:description
].
matches
(
pattern
)))
where
(
t
[
:token
].
matches
(
pattern
).
or
(
t
[
:description
].
matches
(
pattern
)))
end
end
def
self
.
contact_time_deadline
ONLINE_CONTACT_TIMEOUT
.
ago
end
def
set_default_values
def
set_default_values
self
.
token
=
SecureRandom
.
hex
(
15
)
if
self
.
token
.
blank?
self
.
token
=
SecureRandom
.
hex
(
15
)
if
self
.
token
.
blank?
end
end
...
@@ -80,7 +84,7 @@ module Ci
...
@@ -80,7 +84,7 @@ module Ci
end
end
def
online?
def
online?
contacted_at
&&
contacted_at
>
LAST_CONTACT_TIME
contacted_at
&&
contacted_at
>
self
.
class
.
contact_time_deadline
end
end
def
status
def
status
...
...
changelogs/unreleased/fix-runner_online_check.yml
0 → 100644
View file @
eec8a0b1
---
title
:
Fix offline runner detection
merge_request
:
11751
author
:
Alessio Caiazza
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