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
9a8e4863
Commit
9a8e4863
authored
Oct 03, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract method that checks if ci runner needs update
parent
08e31875
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
helpers.rb
lib/ci/api/helpers.rb
+11
-4
No files found.
lib/ci/api/helpers.rb
View file @
9a8e4863
...
...
@@ -31,16 +31,23 @@ module Ci
end
def
update_runner_info
# 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
)
return
unless
current_runner
.
contacted_at
.
nil?
||
Time
.
now
-
current_runner
.
contacted_at
>=
contacted_at_max_age
return
unless
update_runner?
current_runner
.
contacted_at
=
Time
.
now
current_runner
.
assign_attributes
(
get_runner_version_from_params
)
current_runner
.
save
if
current_runner
.
changed?
end
def
update_runner?
# 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
)
current_runner
.
contacted_at
.
nil?
||
(
Time
.
now
-
current_runner
.
contacted_at
)
>=
contacted_at_max_age
end
def
build_not_found!
if
headers
[
'User-Agent'
].
match
(
/gitlab-ci-multi-runner \d+\.\d+\.\d+(~beta\.\d+\.g[0-9a-f]+)? /
)
no_content!
...
...
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