philiprehberger-task_queue 0.4.0 → 0.4.1

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: 6a1d028dda2118c9948cbec0cdff5f7215eeb8d76615acdeaf9a2e7b5f6c45ce
4
- data.tar.gz: 94d56b9b9acb20add7a8e91dd1977f1a87a135e442dadc4c0b8acfc4eb5b5ac1
3
+ metadata.gz: 829177cbd19c6b70ce4e32d03b824d80e0757d833f0f222ed7336156c2491975
4
+ data.tar.gz: 28a1317702057efb8effe2053a5c1b531bc7c13aff26dae835217a5da82d10b8
5
5
  SHA512:
6
- metadata.gz: 4c6f850324f487d516626884c44278bce4927b2419ce9b0036dd2d1c399b41a006c2ab0d48a3f18ef60a9ebcf00ef82fbf6a70e3bc486b78cdea4c397e9dc246
7
- data.tar.gz: efb376ce60b1b9bfe43676ccefb5c0a2d03874e61d897337a6c0268555477478528583be36ab4763c5c0422b1e0fd4734db6bfa7dd738757a9e2f7616b8415f9
6
+ metadata.gz: 9e5ce7cda54494f0756e05a5bd56dbf722553f34890c5b9868b522ad70e6ae587e01afee2ae035b2a61bc7baec4b6d4dd34dde2549d1c93757b08ca88f630932
7
+ data.tar.gz: 8e380685e1a026d5344a754e27c5c74989f17509492e75683ff69ad2ccd2e457707fc272814e228da5c05bfe3cf8c50b4c32599270bb9eadbeb3025611d113ad
data/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.1] - 2026-04-07
11
+
12
+ ### Added
13
+ - `Queue#empty?` to check whether any pending tasks are waiting
14
+
10
15
  ## [0.4.0] - 2026-04-05
11
16
 
12
17
  ### Added
data/README.md CHANGED
@@ -192,6 +192,7 @@ queue.shutdown(timeout: 5)
192
192
  | `#push(&block)` | `&block` — the task to execute | `self` | Enqueue a block for async execution; raises `ArgumentError` if no block given, raises `RuntimeError` if the queue is shut down |
193
193
  | `#<<(callable)` | `callable` — any object responding to `#call` | `self` | Alias for `#push`; convenient for lambdas and procs |
194
194
  | `#size` | _(none)_ | `Integer` | Number of pending (not yet started) tasks |
195
+ | `#empty?` | _(none)_ | `Boolean` | Whether there are no pending tasks waiting to be started |
195
196
  | `#running?` | _(none)_ | `Boolean` | Whether the queue is accepting new tasks |
196
197
  | `#shutdown(timeout:)` | `timeout` — seconds to wait for workers (Numeric, default `30`) | `nil` | Signal workers to stop, drain remaining tasks, join threads up to `timeout` seconds |
197
198
  | `#on_complete(&block)` | `&block` — callback receiving `(result)` | `self` | Register a callback invoked after each successful task completion with the task's return value |
@@ -146,6 +146,15 @@ module Philiprehberger
146
146
  @mutex.synchronize { @tasks.size }
147
147
  end
148
148
 
149
+ # Whether there are no pending tasks waiting to be started.
150
+ #
151
+ # In-flight tasks are not considered; use +drain+ to wait for them.
152
+ #
153
+ # @return [Boolean]
154
+ def empty?
155
+ @mutex.synchronize { @tasks.empty? }
156
+ end
157
+
149
158
  # Whether the queue is accepting new tasks.
150
159
  #
151
160
  # @return [Boolean]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Philiprehberger
4
4
  module TaskQueue
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: philiprehberger-task_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philip Rehberger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-06 00:00:00.000000000 Z
11
+ date: 2026-04-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A lightweight, zero-dependency, thread-safe in-process async job queue
14
14
  with configurable concurrency for Ruby applications.