Last active
August 29, 2015 14:11
-
-
Save hotakasaito/342b55858eaa3720166c to your computer and use it in GitHub Desktop.
paperclipから呼び出すコマンドの負荷を少しでも下げたい ref: http://qiita.com/hotakasaito/items/8751c5fb05e7883af3f2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'paperclip/helpers' | |
Paperclip::Helpers.module_eval do | |
def run(cmd, arguments = "", interpolation_values = {}, local_options = {}) | |
command_path = options[:command_path] | |
Cocaine::CommandLine.path = [Cocaine::CommandLine.path, command_path].flatten.compact.uniq | |
if logging? && (options[:log_command] || local_options[:log_command]) | |
local_options = local_options.merge(:logger => logger) | |
end | |
Cocaine::CommandLine.new("#{Rails.env.production? ? 'ionice -c3 -n7 ' : ''}nice -n19 #{cmd}", arguments, local_options).run(interpolation_values) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment