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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
dc3f9fca
Commit
dc3f9fca
authored
Dec 16, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove locking and add force to FileUtils methods
parent
56638242
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
20 deletions
+12
-20
app/workers/pages_worker.rb
app/workers/pages_worker.rb
+12
-20
No files found.
app/workers/pages_worker.rb
View file @
dc3f9fca
...
@@ -5,7 +5,7 @@ class PagesWorker
...
@@ -5,7 +5,7 @@ class PagesWorker
BLOCK_SIZE
=
32
.
kilobytes
BLOCK_SIZE
=
32
.
kilobytes
MAX_SIZE
=
1
.
terabyte
MAX_SIZE
=
1
.
terabyte
sidekiq_options
queue: :pages
sidekiq_options
queue: :pages
,
retry:
false
def
perform
(
build_id
)
def
perform
(
build_id
)
@build_id
=
build_id
@build_id
=
build_id
...
@@ -44,9 +44,7 @@ class PagesWorker
...
@@ -44,9 +44,7 @@ class PagesWorker
FileUtils
.
mkdir_p
(
pages_path
)
FileUtils
.
mkdir_p
(
pages_path
)
# Lock file for time of deployment to prevent the two processes from doing the concurrent deployment
# Ignore deployment if the HEAD changed when we were extracting the archive
File
.
open
(
lock_path
,
File
::
RDWR
|
File
::
CREAT
,
0644
)
do
|
f
|
f
.
flock
(
File
::
LOCK_EX
)
return
unless
valid?
return
unless
valid?
# Do atomic move of pages
# Do atomic move of pages
...
@@ -54,15 +52,9 @@ class PagesWorker
...
@@ -54,15 +52,9 @@ class PagesWorker
# 1. We move deployed public to previous public path (file removal is slow)
# 1. We move deployed public to previous public path (file removal is slow)
# 2. We move temporary public to be deployed public
# 2. We move temporary public to be deployed public
# 3. We remove previous public path
# 3. We remove previous public path
if
File
.
exists?
(
public_path
)
FileUtils
.
move
(
public_path
,
previous_public_path
,
force:
true
)
FileUtils
.
move
(
public_path
,
previous_public_path
)
end
FileUtils
.
move
(
temp_public_path
,
public_path
)
FileUtils
.
move
(
temp_public_path
,
public_path
)
end
if
File
.
exists?
(
previous_public_path
)
FileUtils
.
rm_r
(
previous_public_path
,
force:
true
)
FileUtils
.
rm_r
(
previous_public_path
,
force:
true
)
end
@status
.
success
@status
.
success
end
end
...
...
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