summaryrefslogtreecommitdiff
path: root/app/models/ci/runner.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-01-21 02:38:58 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-01-21 02:38:58 +0800
commit7a4d723e6ba287fe792dca0a8ddc3d8a77b1876c (patch)
tree3736e8a74bddc028b9588510bcb87bb535ac4c5c /app/models/ci/runner.rb
parent7a109402a866db1c84ef9af1c14e148ec944aa22 (diff)
downloadgitlab-ce-7a4d723e6ba287fe792dca0a8ddc3d8a77b1876c.tar.gz
Remove the key from the queue when runner is deleted
Diffstat (limited to 'app/models/ci/runner.rb')
-rw-r--r--app/models/ci/runner.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb
index b4760b5baaa..f30253eefe3 100644
--- a/app/models/ci/runner.rb
+++ b/app/models/ci/runner.rb
@@ -38,6 +38,8 @@ module Ci
acts_as_taggable
+ after_destroy :cleanup_runner_queue
+
# Searches for runners matching the given query.
#
# This method uses ILIKE on PostgreSQL and LIKE on MySQL.
@@ -143,6 +145,12 @@ module Ci
private
+ def cleanup_runner_queue
+ Gitlab::Redis.with do |redis|
+ redis.del(runner_queue_key)
+ end
+ end
+
def runner_queue_key
"runner:build_queue:#{self.token}"
end