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
7a4d723e
Commit
7a4d723e
authored
Jan 21, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the key from the queue when runner is deleted
parent
7a109402
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
runner.rb
app/models/ci/runner.rb
+8
-0
runner_spec.rb
spec/models/ci/runner_spec.rb
+19
-0
No files found.
app/models/ci/runner.rb
View file @
7a4d723e
...
...
@@ -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
...
...
spec/models/ci/runner_spec.rb
View file @
7a4d723e
...
...
@@ -319,6 +319,25 @@ describe Ci::Runner, models: true do
end
end
describe
'#destroy'
do
let
(
:runner
)
{
create
(
:ci_runner
)
}
context
'when there is a tick in the queue'
do
let!
(
:queue_key
)
{
runner
.
send
(
:runner_queue_key
)
}
before
do
runner
.
tick_runner_queue
runner
.
destroy
end
it
'cleans up the queue'
do
Gitlab
::
Redis
.
with
do
|
redis
|
expect
(
redis
.
get
(
queue_key
)).
to
be_nil
end
end
end
end
describe
'.assignable_for'
do
let
(
:runner
)
{
create
(
:ci_runner
)
}
let
(
:project
)
{
create
(
:project
)
}
...
...
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