diff options
author | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2016-12-14 18:06:50 +0300 |
---|---|---|
committer | Kim "BKC" Carlbäcker <kim.carlbacker@gmail.com> | 2016-12-14 18:06:50 +0300 |
commit | a6ab8a34093ccd2de7286797ccc639c1cbf267fd (patch) | |
tree | 8e55c38a4525cfa5b36472456f9f9e39259f64e0 /app/workers/build_queue_worker.rb | |
parent | afea2df15121c0fa4d36f16b050421f681564b64 (diff) |
Add BuildQueueWorker for injecting redis-keys
Diffstat (limited to 'app/workers/build_queue_worker.rb')
-rw-r--r-- | app/workers/build_queue_worker.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/workers/build_queue_worker.rb b/app/workers/build_queue_worker.rb new file mode 100644 index 00000000000..f19290b0c1a --- /dev/null +++ b/app/workers/build_queue_worker.rb @@ -0,0 +1,18 @@ +class BuildQueueWorker + include Sidekiq::Worker + include BuildQueue + + def perform(build_id) + Ci::Build.find_by(id: build_id).try do |build| + project.runners.select do |runner| + if runner.can_pick?(build) + # Inject last_update into Redis + Gitlab::Redis.with do |redis] + new_update = Time.new.inspect + redis.set(current_runner_redis_key, new_update, ex: 60.minutes) + end + end + end + end + end +end |