Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
ca0d8438
Commit
ca0d8438
authored
Mar 16, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve rename projects migration
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
4a81867d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
30 deletions
+1
-30
db/post_migrate/20170313133418_rename_more_reserved_project_names.rb
...rate/20170313133418_rename_more_reserved_project_names.rb
+1
-30
No files found.
db/post_migrate/20170313133418_rename_more_reserved_project_names.rb
View file @
ca0d8438
...
...
@@ -6,41 +6,12 @@ class RenameMoreReservedProjectNames < ActiveRecord::Migration
DOWNTIME
=
false
THREAD_COUNT
=
8
KNOWN_PATHS
=
%w(artifacts graphs refs badges)
.
freeze
def
up
queues
=
Array
.
new
(
THREAD_COUNT
)
{
Queue
.
new
}
start
=
false
threads
=
Array
.
new
(
THREAD_COUNT
)
do
|
index
|
Thread
.
new
do
queue
=
queues
[
index
]
# Wait until we have input to process.
until
start
;
end
rename_projects
(
queue
.
pop
)
until
queue
.
empty?
end
end
enum
=
queues
.
each
reserved_projects
.
each_slice
(
100
)
do
|
slice
|
begin
queue
=
enum
.
next
rescue
StopIteration
enum
.
rewind
retry
end
queue
<<
slice
rename_projects
(
slice
)
end
start
=
true
threads
.
each
(
&
:join
)
end
def
down
...
...
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