concurrent_worker 0.4.3 → 0.4.4
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_worker/version.rb +1 -1
- data/lib/concurrent_worker/workerpool.rb +15 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e17ddb27f442c6babe1733fb794b8870bc153a6b9091a7f4b4bc154da9d276b
|
4
|
+
data.tar.gz: f54a309bf21e32ad198b06732d31434e9846e9c456e6286c826f8acdea4c432c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c65980f5b3816eea2ce575a0334c57079d7ef77067dc5413c196ea662411a636c4bbd0728bd43771241c6b73fe3d34cfef2d973d64e6e891831d81bac1c26b2
|
7
|
+
data.tar.gz: c00dfd2621584625792b6698905a336a9ea2c39e42f9b57e05fe85fa46718f86e703f7afbb6e2e3d566f149e8684f2e81ddb613545ab3854d45f40fd6b957359
|
data/Gemfile.lock
CHANGED
@@ -23,6 +23,10 @@ module ConcurrentWorker
|
|
23
23
|
end
|
24
24
|
|
25
25
|
|
26
|
+
def queue_closed?
|
27
|
+
@req_counter.closed?
|
28
|
+
end
|
29
|
+
|
26
30
|
def need_new_worker?
|
27
31
|
self.size < @max_num && self.select{ |w| w.queue_empty? }.empty?
|
28
32
|
end
|
@@ -99,9 +103,15 @@ module ConcurrentWorker
|
|
99
103
|
@snd_queue.push(req)
|
100
104
|
end
|
101
105
|
end
|
102
|
-
|
103
|
-
w.snd_queue_max
|
104
|
-
|
106
|
+
|
107
|
+
if w.snd_queue_max == 0
|
108
|
+
2.times do
|
109
|
+
@ready_queue.push(w)
|
110
|
+
end
|
111
|
+
else
|
112
|
+
w.snd_queue_max.times do
|
113
|
+
@ready_queue.push(w)
|
114
|
+
end
|
105
115
|
end
|
106
116
|
end
|
107
117
|
|
@@ -132,9 +142,10 @@ module ConcurrentWorker
|
|
132
142
|
end
|
133
143
|
|
134
144
|
def req(*args, &work_block)
|
135
|
-
@req_counter.wait_until_less_than(@max_num * @snd_queue_max)
|
145
|
+
@req_counter.wait_until_less_than(@max_num * @snd_queue_max) if @snd_queue_max > 0
|
136
146
|
@req_counter.push(true)
|
137
147
|
@snd_queue.push([args, work_block])
|
148
|
+
true
|
138
149
|
end
|
139
150
|
|
140
151
|
def join
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concurrent_worker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dddogdiamond
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|