Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Автоматическое определение числа ядер для размера очереди.

  • Loading branch information...
commit 31d3fd30fe49accd7145f549d0ca6cb592bf3b0e 1 parent b0a2f93
@Tyralion Tyralion authored
View
4 lib/acts_as_files.rb
@@ -9,7 +9,9 @@ module ActsAsFiles
AR = defined?(ActiveRecord)
ID = (ActsAsFiles::MONGOID ? :_id : :id)
- CRAWLER = ::GirlFriday::Queue.new('image_crawler', :size => 5) do |arr|
+ CORES = `cat /proc/cpuinfo | grep processor | wc -l`.chop.to_i
+
+ CRAWLER = ::GirlFriday::Queue.new('image_crawler', :size => ::ActsAsFiles::CORES) do |arr|
(parent, mark, action) = arr
View
2  lib/acts_as_files/multimedia/instance_methods.rb
@@ -32,7 +32,7 @@ def image?
#
def file_mime_type
- (result, answer) = [`file --mime-type -b "#{self.path}"`.strip, $?]
+ (result, answer) = [`file --mime-type -b "#{self.path}"`.chomp.strip, $?]
answer.exitstatus == 0 ? result : nil
end # file_mime_type
Please sign in to comment.
Something went wrong with that request. Please try again.