File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -92,18 +92,16 @@ module Fiber::ExecutionContext
9292 # parallel execution context for example.
9393 #
9494 # Respects the `CRYSTAL_WORKERS` environment variable if present and valid,
95- # and otherwise defaults to the minimum number of logical CPUs available to
96- # the process or available on the computer.
95+ # and otherwise defaults to the number of logical CPUs available to the
96+ # process or on the computer.
9797 def self.default_workers_count : Int32
98- if count = ENV [" CRYSTAL_WORKERS" ]?.try(& .to_i?)
99- return count.clamp(1 ..)
100- end
101-
102- total = System .cpu_count.to_i.clamp(1 ..)
103- effective = Crystal ::System .effective_cpu_count.to_i.clamp(1 ..)
98+ count = ENV [" CRYSTAL_WORKERS" ]?.try(& .to_i?) || -1
99+ count = Crystal ::System .effective_cpu_count.to_i if count == -1
100+ count = System .cpu_count.to_i if count == -1
104101 # TODO: query for CPU limits (e.g. linux/cgroup, freebsd/rctl, ...)
105102
106- Math .min(total, effective)
103+ # always report at least 1 worker
104+ count.clamp(1 ..)
107105 end
108106
109107 # :nodoc:
Original file line number Diff line number Diff line change @@ -930,7 +930,7 @@ abstract class IO
930930 # io.rewind
931931 # io.read_bytes(Int32, IO::ByteFormat::LittleEndian) # => 0x01020304
932932 # ```
933- def read_bytes (type : T .class , format : IO ::ByteFormat = IO ::ByteFormat ::SystemEndian ) : T forall T
933+ def read_bytes (type , format : IO ::ByteFormat = IO ::ByteFormat ::SystemEndian )
934934 type .from_io(self , format)
935935 end
936936
You can’t perform that action at this time.
0 commit comments