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
Léo-Paul Géneau
gitlab-ce
Commits
6a29ac7d
Commit
6a29ac7d
authored
Aug 31, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change update interval of runners when trying to preserve contacted_at
parent
1d548869
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
5 deletions
+8
-5
CHANGELOG
CHANGELOG
+1
-0
app/models/ci/runner.rb
app/models/ci/runner.rb
+1
-1
lib/ci/api/builds.rb
lib/ci/api/builds.rb
+1
-1
lib/ci/api/helpers.rb
lib/ci/api/helpers.rb
+5
-3
No files found.
CHANGELOG
View file @
6a29ac7d
...
@@ -63,6 +63,7 @@ v 8.12.0 (unreleased)
...
@@ -63,6 +63,7 @@ v 8.12.0 (unreleased)
- Fix badge count alignment (ClemMakesApps)
- Fix badge count alignment (ClemMakesApps)
- Remove green outline from `New branch unavailable` button on issue page !5858 (winniehell)
- Remove green outline from `New branch unavailable` button on issue page !5858 (winniehell)
- Fix repo title alignment (ClemMakesApps)
- Fix repo title alignment (ClemMakesApps)
- Change update interval of contacted_at
- Fix branch title trailing space on hover (ClemMakesApps)
- Fix branch title trailing space on hover (ClemMakesApps)
- Award emoji tooltips containing more than 10 usernames are now truncated !4780 (jlogandavison)
- Award emoji tooltips containing more than 10 usernames are now truncated !4780 (jlogandavison)
- Fix duplicate "me" in award emoji tooltip !5218 (jlogandavison)
- Fix duplicate "me" in award emoji tooltip !5218 (jlogandavison)
...
...
app/models/ci/runner.rb
View file @
6a29ac7d
...
@@ -2,7 +2,7 @@ module Ci
...
@@ -2,7 +2,7 @@ module Ci
class
Runner
<
ActiveRecord
::
Base
class
Runner
<
ActiveRecord
::
Base
extend
Ci
::
Model
extend
Ci
::
Model
LAST_CONTACT_TIME
=
5
.
minute
s
.
ago
LAST_CONTACT_TIME
=
2
.
hour
s
.
ago
AVAILABLE_SCOPES
=
%w[specific shared active paused online]
AVAILABLE_SCOPES
=
%w[specific shared active paused online]
FORM_EDITABLE
=
%i[description tag_list active run_untagged locked]
FORM_EDITABLE
=
%i[description tag_list active run_untagged locked]
...
...
lib/ci/api/builds.rb
View file @
6a29ac7d
...
@@ -12,7 +12,7 @@ module Ci
...
@@ -12,7 +12,7 @@ module Ci
# POST /builds/register
# POST /builds/register
post
"register"
do
post
"register"
do
authenticate_runner!
authenticate_runner!
update_runner_last_contact
update_runner_last_contact
(
save:
false
)
update_runner_info
update_runner_info
required_attributes!
[
:token
]
required_attributes!
[
:token
]
not_found!
unless
current_runner
.
active?
not_found!
unless
current_runner
.
active?
...
...
lib/ci/api/helpers.rb
View file @
6a29ac7d
...
@@ -3,7 +3,7 @@ module Ci
...
@@ -3,7 +3,7 @@ module Ci
module
Helpers
module
Helpers
BUILD_TOKEN_HEADER
=
"HTTP_BUILD_TOKEN"
BUILD_TOKEN_HEADER
=
"HTTP_BUILD_TOKEN"
BUILD_TOKEN_PARAM
=
:token
BUILD_TOKEN_PARAM
=
:token
UPDATE_RUNNER_EVERY
=
60
UPDATE_RUNNER_EVERY
=
40
*
60
def
authenticate_runners!
def
authenticate_runners!
forbidden!
unless
runner_registration_token_valid?
forbidden!
unless
runner_registration_token_valid?
...
@@ -22,11 +22,13 @@ module Ci
...
@@ -22,11 +22,13 @@ module Ci
params
[
:token
]
==
current_application_settings
.
runners_registration_token
params
[
:token
]
==
current_application_settings
.
runners_registration_token
end
end
def
update_runner_last_contact
def
update_runner_last_contact
(
save:
true
)
# Use a random threshold to prevent beating DB updates
# Use a random threshold to prevent beating DB updates
# it generates a distribution between: [40m, 80m]
contacted_at_max_age
=
UPDATE_RUNNER_EVERY
+
Random
.
rand
(
UPDATE_RUNNER_EVERY
)
contacted_at_max_age
=
UPDATE_RUNNER_EVERY
+
Random
.
rand
(
UPDATE_RUNNER_EVERY
)
if
current_runner
.
contacted_at
.
nil?
||
Time
.
now
-
current_runner
.
contacted_at
>=
contacted_at_max_age
if
current_runner
.
contacted_at
.
nil?
||
Time
.
now
-
current_runner
.
contacted_at
>=
contacted_at_max_age
current_runner
.
update_attributes
(
contacted_at:
Time
.
now
)
current_runner
.
contacted_at
=
Time
.
now
current_runner
.
save
if
current_runner
.
changed?
&&
save
end
end
end
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