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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/concurrent_executor.rb +4 -3
- data/lib/concurrent_executor/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4133517b7c5bf096c59d681407a402e57a0c1269dcebf5373f851a931d3f74c
|
4
|
+
data.tar.gz: db6df18faa9ea13a5c4bf76fbfea9e0e91c912aa014f552047dba4bb35845c91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '099f52c9fbf4dbab34056430d7f075d20c1d8e53ceec68166a2033c86ce438417fe02f1b2fc91bd7a4de65e9f46f53862b83710972d5fbe3b7d966f22bc6ee80'
|
7
|
+
data.tar.gz: d229de2a71b9dc4c593d7d5d4c0fa85ebb997792c71ca6ae8ec22dfb6122ab55403621f21fd5f119dd306b1eb3d97525015d4bb96a952b0c5236b93fb924374b
|
data/Gemfile.lock
CHANGED
data/lib/concurrent_executor.rb
CHANGED
@@ -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))
|
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.
|
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-
|
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.
|
110
|
+
rubygems_version: 3.0.3
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Execute things concurrently
|