msg-batcher 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/msg-batcher.rb +8 -2
- 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: d684cdfcf05808ca303c7952ee150250a419a0b8e3cc09b95ff04ec1951e2267
|
4
|
+
data.tar.gz: cccfb2b3897d60c6fa90c2c0849cfd233b6d42524056b795c02c5d0434cc1355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c5cbccd73b45cf7a96434e9e27b0e0c1ec3a835e9f18ab515a708646912512262504a2ace353bd0c255ee4f934c05acff76b9ae569d9c232d2d9aecaf88b089
|
7
|
+
data.tar.gz: e90b43430275a946a44dcd5ffd66ca2ba911eb26404faba334848e82c16d45d3a929391f5c8454024b4eef5e6faac946e90fbcb3485a2bcfae762f4498cee7ad
|
data/lib/msg-batcher.rb
CHANGED
@@ -35,9 +35,12 @@ class MsgBatcher
|
|
35
35
|
start_timer
|
36
36
|
end
|
37
37
|
|
38
|
-
def kill
|
38
|
+
def kill(blocking: true)
|
39
39
|
@closed = true
|
40
|
-
|
40
|
+
# releasing timer thread
|
41
|
+
@timer_start_cv.signal
|
42
|
+
@timer_release_cv.signal
|
43
|
+
@timer_thread.join if blocking
|
41
44
|
end
|
42
45
|
|
43
46
|
# Thread-safe
|
@@ -126,12 +129,15 @@ class MsgBatcher
|
|
126
129
|
|
127
130
|
dputs "TT1"
|
128
131
|
@timer_start_cv.wait @m2
|
132
|
+
break if @closed
|
133
|
+
|
129
134
|
dputs "TT1 after wait"
|
130
135
|
@timer_started_cv.signal
|
131
136
|
|
132
137
|
dputs "TT2"
|
133
138
|
# then wait either time to elapse or signal that data has been released
|
134
139
|
@timer_release_cv.wait @m2, @max_time_msecs / 1000.0
|
140
|
+
break if @closed
|
135
141
|
|
136
142
|
dputs "timer end #{@m2.owned?}"
|
137
143
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msg-batcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ertygiq
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A Ruby library that facilitates thread-safe batch processing of messages.
|
14
14
|
In certain situations, processing multiple messages in batch is more efficient than
|