app/models/switchman/shard.rb
# given the provided option, determines whether we need to (and whether
# it's possible) to determine a reasonable default.
given the provided option, determines whether we need to (and whether
it's possible) to determine a reasonable default.
given the provided option determines whether we need to ( and whether it ' s possible ) to determine a reasonable default .
def determine_max_procs(max_procs_input, parallel_input=2)
        max_procs = nil
        if max_procs_input
          max_procs = max_procs_input.to_i
          max_procs = nil if max_procs == 0
        else
          return 1 if parallel_input.nil? || parallel_input < 1
          cpus = Environment.cpu_count
          if cpus && cpus > 0
            max_procs = cpus * parallel_input
          end
        end
        return max_procs
      end
def determine_max_procs ( max_procs_input , parallel_input = 2 ) max_procs = nil if max_procs_input max_procs = max_procs_input . to_i max_procs = nil if max_procs == 0 else return 1 if parallel_input . nil? || parallel_input < 1 cpus = Environment . cpu_count if cpus && cpus > 0 max_procs = cpus * parallel_input end end return max_procs end
given the provided option, determines whether we need to (and whether
it's possible) to determine a reasonable default.
given the provided option determines whether we need to ( and whether it ' s possible ) to determine a reasonable default .
max_procs_input
<not_specific>
parallel_input
<not_specific>