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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/msg-batcher.rb +8 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac80b44e3f48248b2355ee73c5ed6346a492f9f5749ba670fbc18310171535cc
4
- data.tar.gz: 42537898648e2e953ebb3df19fec938db4cc8da487f5014569a4477a71c666ff
3
+ metadata.gz: d684cdfcf05808ca303c7952ee150250a419a0b8e3cc09b95ff04ec1951e2267
4
+ data.tar.gz: cccfb2b3897d60c6fa90c2c0849cfd233b6d42524056b795c02c5d0434cc1355
5
5
  SHA512:
6
- metadata.gz: 8a478b76db6a65bb7a428e01d714a76486f7d1932328b0157da799f83fb05767cab488108ae7dd16b531110e99ea3b6d5dcae15e02bd667e6e9b52e27caea955
7
- data.tar.gz: fade326da9e58081a4a8d89d8f05bd368995556c97a12a805f38802974cbe481a3c54a597c1cf23764bd476463269f5b9bd41c62ea6b0d5c58829763704494bc
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
- @timer_thread.exit
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.1
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-10 00:00:00.000000000 Z
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