concurrent_executor 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f1975dab1c7cd6e9f3d28d145d6dbb9dbe56b9e2cdffbded41d1c429abe9b6c
4
- data.tar.gz: b11700ed8f4e9fe790840b9381949b9917ba2433b2c0919dac981c2d7eaa4622
3
+ metadata.gz: b4133517b7c5bf096c59d681407a402e57a0c1269dcebf5373f851a931d3f74c
4
+ data.tar.gz: db6df18faa9ea13a5c4bf76fbfea9e0e91c912aa014f552047dba4bb35845c91
5
5
  SHA512:
6
- metadata.gz: 2b5c684a7a533597d6948e64b07cd85fb22d95c8b05b46fbe2fa3c542abba1db2b677d6c7902bd2e4c9514dd863195e847234476bdae89789404781fadd2120b
7
- data.tar.gz: a4da54f9daa7366c557ffde0731334abaf3970af134a34c45a6d5e8fc0b5d68a52821126990ea41989601b90b294cda94665058066532c598e6e18e642baba52
6
+ metadata.gz: '099f52c9fbf4dbab34056430d7f075d20c1d8e53ceec68166a2033c86ce438417fe02f1b2fc91bd7a4de65e9f46f53862b83710972d5fbe3b7d966f22bc6ee80'
7
+ data.tar.gz: d229de2a71b9dc4c593d7d5d4c0fa85ebb997792c71ca6ae8ec22dfb6122ab55403621f21fd5f119dd306b1eb3d97525015d4bb96a952b0c5236b93fb924374b
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- concurrent_executor (1.0.0)
4
+ concurrent_executor (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -4,9 +4,9 @@ require 'logger'
4
4
 
5
5
  class ConcurrentExecutor
6
6
  MAX_NUMBER_OF_THREADS = 100
7
- attr_accessor :threads, :queue, :number_of_threads, :executor, :logger
7
+ attr_accessor :threads, :queue, :number_of_threads, :executor, :logger, :trace
8
8
 
9
- def initialize(number_of_threads: 4, queue_size: 100, executor: nil)
9
+ def initialize(number_of_threads: 4, queue_size: 100, executor: nil, trace: true)
10
10
  raise 'queue must be sized' unless queue_size
11
11
  raise 'number of threads must be > 0' unless (0..MAX_NUMBER_OF_THREADS).cover?(number_of_threads)
12
12
 
@@ -25,6 +25,7 @@ class ConcurrentExecutor
25
25
  self.executor = executor
26
26
  self.queue = SizedQueue.new(queue_size)
27
27
  self.number_of_threads = number_of_threads
28
+ self.trace = trace
28
29
 
29
30
  start_threads
30
31
  end
@@ -57,7 +58,7 @@ class ConcurrentExecutor
57
58
 
58
59
  def start_threads
59
60
  number_of_threads.times do
60
- threads << if Thread.respond_to?(:new_traced)
61
+ threads << if self.trace && Thread.respond_to?(:new_traced)
61
62
  Thread.new_traced(&method(:work_loop))
62
63
  else
63
64
  Thread.new(&method(:work_loop))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ConcurrentExecutorVersion
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concurrent_executor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Malinconico
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
- rubygems_version: 3.0.1
110
+ rubygems_version: 3.0.3
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Execute things concurrently