parallel 1.25.1 → 1.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbe5c533cb72ebc99c0faab4e37294569296d4f194f4f46867b028d89694fab9
4
- data.tar.gz: a0d78777b5c05ea9e3d85e56f4cbabb4424b0572ec1effb46c80015e54f83a31
3
+ metadata.gz: 404f38d083ffa4ed2163c3018f5243fe487b6154905afa83b59320380bd3629a
4
+ data.tar.gz: 832f558729b425fa3e2ad6b9a3d6418c44d0f4a2ecc180a398a28b2301cd5cab
5
5
  SHA512:
6
- metadata.gz: 7bf346461d68ad2c82db5be3830821e1ed55aabd4bd01eec0be8c58dcdb3c68be6e58840850925a9aef41097d5bb7209d276e5421d6acb047013d2201e4a25e9
7
- data.tar.gz: 1f88723705a9d9e46486b50f69c9c64422cad9c32239303c353c6a1aa8003a920a48af11ffa2943b71910aa56cfffd6df5f997ef5c8d576d337500e309d25892
6
+ metadata.gz: 5947502dc01d242a8a1cef0e2133cc3df913107941f5ba5bd82032bda76de6358bc44e62848909a75f2bfa45c867ee099f454c2652555265d734a166c988d144
7
+ data.tar.gz: '08f69f6c82041f015dee319ccc42bb0b1e20fc3d58b4e4007c1636ce459a71b0625ebb3ec8c28549562c1ed3f99f4182da41d8741a42eeeb4a96cb51b9bff701'
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Parallel
3
- VERSION = Version = '1.25.1' # rubocop:disable Naming/ConstantName
3
+ VERSION = Version = '1.26.3' # rubocop:disable Naming/ConstantName
4
4
  end
data/lib/parallel.rb CHANGED
@@ -337,10 +337,10 @@ module Parallel
337
337
  end
338
338
  end
339
339
 
340
- # Number of processors seen by the OS, used for process scheduling
340
+ # Number of processors seen by the OS or value considering CPU quota if the process is inside a cgroup,
341
+ # used for process scheduling
341
342
  def processor_count
342
- require 'etc'
343
- @processor_count ||= Integer(ENV['PARALLEL_PROCESSOR_COUNT'] || Etc.nprocessors)
343
+ @processor_count ||= Integer(ENV['PARALLEL_PROCESSOR_COUNT'] || available_processor_count)
344
344
  end
345
345
 
346
346
  def worker_number
@@ -695,5 +695,14 @@ module Parallel
695
695
  return unless (on_start = options[:start])
696
696
  options[:mutex].synchronize { on_start.call(item, index) }
697
697
  end
698
+
699
+ def available_processor_count
700
+ gem 'concurrent-ruby', '>= 1.3.4'
701
+ require 'concurrent-ruby'
702
+ Concurrent.available_processor_count.floor
703
+ rescue LoadError
704
+ require 'etc'
705
+ Etc.nprocessors
706
+ end
698
707
  end
699
708
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.25.1
4
+ version: 1.26.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-08 00:00:00.000000000 Z
11
+ date: 2024-08-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it
@@ -24,8 +24,8 @@ licenses:
24
24
  - MIT
25
25
  metadata:
26
26
  bug_tracker_uri: https://github.com/grosser/parallel/issues
27
- documentation_uri: https://github.com/grosser/parallel/blob/v1.25.1/Readme.md
28
- source_code_uri: https://github.com/grosser/parallel/tree/v1.25.1
27
+ documentation_uri: https://github.com/grosser/parallel/blob/v1.26.3/Readme.md
28
+ source_code_uri: https://github.com/grosser/parallel/tree/v1.26.3
29
29
  wiki_uri: https://github.com/grosser/parallel/wiki
30
30
  post_install_message:
31
31
  rdoc_options: []