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
Boxiang Sun
gitlab-ce
Commits
d8fa256f
Commit
d8fa256f
authored
May 23, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a monkey pach of
https://github.com/carrierwaveuploader/carrierwave/pull/2314
parent
014f5f6a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
config/initializers/carrierwave_monkey_patch.rb
config/initializers/carrierwave_monkey_patch.rb
+41
-0
No files found.
config/initializers/carrierwave_monkey_patch.rb
0 → 100644
View file @
d8fa256f
# This is a monkey patch until https://github.com/carrierwaveuploader/carrierwave/pull/2314 has been merged
# This fixes a problem https://gitlab.com/gitlab-org/gitlab-ce/issues/46182 that carrierwave loads large files into memory
# and triggers sidekiq shutdown by hitting RSS limit.
module
CarrierWave
module
Storage
class
Fog
<
Abstract
class
File
def
read
file_body
=
file
.
body
return
if
file_body
.
nil?
return
file_body
unless
file_body
.
is_a?
(
::
File
)
begin
file_body
=
::
File
.
open
(
file_body
.
path
)
if
file_body
.
closed?
# Reopen if it's closed
file_body
.
read
ensure
file_body
.
close
end
end
def
store
(
new_file
)
if
new_file
.
is_a?
(
self
.
class
)
new_file
.
copy_to
(
path
)
else
fog_file
=
new_file
.
to_file
@content_type
||=
new_file
.
content_type
@file
=
directory
.
files
.
create
({
:body
=>
fog_file
?
fog_file
:
new_file
.
read
,
:content_type
=>
@content_type
,
:key
=>
path
,
:public
=>
@uploader
.
fog_public
}.
merge
(
@uploader
.
fog_attributes
))
fog_file
.
close
if
fog_file
&&
!
fog_file
.
closed?
end
true
end
end
end
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