First attempt
This commit is contained in:
parent
3a90612660
commit
afea2df151
2 changed files with 20 additions and 0 deletions
|
@ -16,6 +16,15 @@ module Ci
|
|||
not_found! unless current_runner.active?
|
||||
update_runner_info
|
||||
|
||||
last_update = Gitlab::Redis.with { |redis| redis.get(current_runner_redis_key)}
|
||||
|
||||
if params[:last_update] != ""
|
||||
if :last_update == last_update
|
||||
headers 'X-GitLab-Last-Update', last_update
|
||||
return build_not_found!
|
||||
end
|
||||
end
|
||||
|
||||
build = Ci::RegisterBuildService.new.execute(current_runner)
|
||||
|
||||
if build
|
||||
|
@ -26,6 +35,14 @@ module Ci
|
|||
else
|
||||
Gitlab::Metrics.add_event(:build_not_found)
|
||||
|
||||
if last_update == ""
|
||||
Gitlab::Redis.with do |redis]
|
||||
new_update = Time.new.inspect
|
||||
redis.set(current_runner_redis_key, new_update, ex: 60.minutes)
|
||||
headers 'X-GitLab-Last-Update', new_update
|
||||
end
|
||||
end
|
||||
|
||||
build_not_found!
|
||||
end
|
||||
end
|
||||
|
|
|
@ -60,6 +60,9 @@ module Ci
|
|||
@runner ||= Runner.find_by_token(params[:token].to_s)
|
||||
end
|
||||
|
||||
def current_runner_redis_key
|
||||
@runner_redis_key ||= "#{current_runner.token}_#{current_runner.tag_list}"
|
||||
|
||||
def get_runner_version_from_params
|
||||
return unless params["info"].present?
|
||||
attributes_for_keys(["name", "version", "revision", "platform", "architecture"], params["info"])
|
||||
|
|
Loading…
Reference in a new issue