diff options
author | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2016-12-15 22:30:31 +0100 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2016-12-15 22:30:31 +0100 |
commit | e179544342247c9a227c1ef3c3e709a0449158e3 (patch) | |
tree | 4e3cd73f3ad4f2e13334c89073238c181186bf2a /lib/ci | |
parent | 771dd68cdff9c1f57082fd99af5c22c3af96e7c5 (diff) | |
download | gitlab-ce-e179544342247c9a227c1ef3c3e709a0449158e3.tar.gz |
Move redis-logic into Ci::Runner
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/api/builds.rb | 11 | ||||
-rw-r--r-- | lib/ci/api/helpers.rb | 4 |
2 files changed, 3 insertions, 12 deletions
diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb index df32f64ef83..fb14f043a18 100644 --- a/lib/ci/api/builds.rb +++ b/lib/ci/api/builds.rb @@ -16,7 +16,7 @@ module Ci not_found! unless current_runner.active? update_runner_info - last_update = Gitlab::Redis.with { |redis| redis.get(current_runner_redis_key)} + last_update = current_runner.last_build_queue_update if params[:last_update].present? if params[:last_update] == last_update @@ -35,13 +35,8 @@ 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 + new_update = current_runner.tick_update + headers 'X-GitLab-Last-Update', new_update build_not_found! end diff --git a/lib/ci/api/helpers.rb b/lib/ci/api/helpers.rb index 74e1871619e..e608f5f6cad 100644 --- a/lib/ci/api/helpers.rb +++ b/lib/ci/api/helpers.rb @@ -60,10 +60,6 @@ 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}" - end - def get_runner_version_from_params return unless params["info"].present? attributes_for_keys(["name", "version", "revision", "platform", "architecture"], params["info"]) |