concurrent_worker 0.4.3 → 0.4.4

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: e56634916dc036659f6d54c23222848245290ed9281b403268e0e1fa6c434ab4
4
- data.tar.gz: ab979cc0dd7b75f00272f7cbd243a5fa6688d91556905731194ced74534ba16c
3
+ metadata.gz: 7e17ddb27f442c6babe1733fb794b8870bc153a6b9091a7f4b4bc154da9d276b
4
+ data.tar.gz: f54a309bf21e32ad198b06732d31434e9846e9c456e6286c826f8acdea4c432c
5
5
  SHA512:
6
- metadata.gz: c02c7b51f59108cf48db4e5d9eab8e5789c49015c15b3b0203b1fdd99d9cd02771ea6ec7ac83f171f08644b943267b325a05e0162afd03d417f8eb6c070ab356
7
- data.tar.gz: f5eac16902da77e20410470520badd1da0b28bb6239fb64a2fad72622515c20971ead92a3b57ac12ad13f3dd8add2f50472a8735124e65af60daf93882eb5f54
6
+ metadata.gz: 1c65980f5b3816eea2ce575a0334c57079d7ef77067dc5413c196ea662411a636c4bbd0728bd43771241c6b73fe3d34cfef2d973d64e6e891831d81bac1c26b2
7
+ data.tar.gz: c00dfd2621584625792b6698905a336a9ea2c39e42f9b57e05fe85fa46718f86e703f7afbb6e2e3d566f149e8684f2e81ddb613545ab3854d45f40fd6b957359
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- concurrent_worker (0.4.3)
4
+ concurrent_worker (0.4.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module ConcurrentWorker
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
@@ -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.times do
104
- @ready_queue.push(w)
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.3
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-16 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler