Module: SprocketsDerailleur
- Defined in:
- lib/sprockets-derailleur/file_store.rb,
lib/sprockets-derailleur.rb
Overview
The Sprockets::Cache::FileStore is not thread/parallel safe. This one uses file locks to be safe.
Defined Under Namespace
Classes: FileStore
Class Method Summary collapse
Class Method Details
.number_of_processors ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sprockets-derailleur.rb', line 6 def self.number_of_processors if RUBY_PLATFORM =~ /linux/ return `cat /proc/cpuinfo | grep processor | wc -l`.to_i elsif RUBY_PLATFORM =~ /darwin/ return `sysctl -n hw.physicalcpu`.to_i elsif RUBY_PLATFORM =~ /win32/ # this works for windows 2000 or greater require 'win32ole' wmi = WIN32OLE.connect("winmgmts://") wmi.ExecQuery("select * from Win32_ComputerSystem").each do |system| begin processors = system.NumberOfLogicalProcessors rescue processors = 0 end return [system.NumberOfProcessors, processors].max end end raise "can't determine 'number_of_processors' for '#{RUBY_PLATFORM}'" end |
.worker_count ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/sprockets-derailleur.rb', line 27 def self.worker_count worker_count = ENV['SPROCKETS_DERAILLEUR_WORKER_COUNT'].to_i return worker_count if worker_count > 0 number_of_processors rescue 1 end |