philiprehberger-task_queue 0.6.0 → 0.7.0

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: 4729f65b6cd35decf68be8f1850b13609d87457fa049d8914f74ade8d89f9193
4
- data.tar.gz: 5e26c336765fbf7e73c2bdd132a2791bbf60d0191b8748f90768cb934e4a449f
3
+ metadata.gz: e39241a1442d74c80e1e1588468bd8ad95353479568b0be9ccf31084bd755585
4
+ data.tar.gz: b00310624003336ce97b36fe9931f4a11e5f4081814c3c30d2364c4f4619c527
5
5
  SHA512:
6
- metadata.gz: f68ed0d8be0ead8665425550efbd32d467def35234bff29875d328cabf2ab722da88789ac3a97c60b0cc29a1c299b3c015b9eea0d65ace89677592f12fd2c8d7
7
- data.tar.gz: 79d4ead9724546b60ee902815899b79f573cdd6a09a1d51eb93a78dc5062355827b76b2542b1a2150db4461fa8ee459aefdf2f1374816c576fb228dd5ae41b45
6
+ metadata.gz: 2c6ebf43fccdbbd00158f78859cdd79e4767e4148a82a55d81179a4be71b9346274c8ab419af1daf0a58ebd2214080bbc9b5d7b77a19267d2beefbe54b57fbf5
7
+ data.tar.gz: a08587cc8f79fdfcb11e3076d411225098596ad64a0b17e0c3f86e55ec142582a5018dc6832b622c77ff0bcc2bc97b55116ee3cd2384fe17bbce1fe6d4d6011c
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.7.0] - 2026-05-13
11
+
12
+ ### Added
13
+ - `Queue#busy?` — predicate returning `true` when there are pending tasks or in-flight tasks; convenient inverse of "idle" for callers polling without going through `#stats`.
14
+
10
15
  ## [0.6.0] - 2026-05-07
11
16
 
12
17
  ### Added
data/README.md CHANGED
@@ -205,6 +205,7 @@ queue.shutdown(timeout: 5)
205
205
  | `#<<(callable)` | `callable` — any object responding to `#call` | `self` | Alias for `#push`; convenient for lambdas and procs |
206
206
  | `#size` | _(none)_ | `Integer` | Number of pending (not yet started) tasks |
207
207
  | `#empty?` | _(none)_ | `Boolean` | Whether there are no pending tasks waiting to be started |
208
+ | `#busy?` | _(none)_ | `Boolean` | Whether the queue has any pending tasks or in-flight tasks |
208
209
  | `#running?` | _(none)_ | `Boolean` | Whether the queue is accepting new tasks |
209
210
  | `#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 |
210
211
  | `#on_complete(&block)` | `&block` — callback receiving `(result)` | `self` | Register a callback invoked after each successful task completion with the task's return value |
@@ -173,6 +173,16 @@ module Philiprehberger
173
173
  @mutex.synchronize { @tasks.empty? }
174
174
  end
175
175
 
176
+ # Whether the queue has any pending tasks or any in-flight tasks.
177
+ #
178
+ # Convenient inverse of "idle" for callers polling without going
179
+ # through +stats+. Equivalent to: +!empty? || in_flight > 0+.
180
+ #
181
+ # @return [Boolean]
182
+ def busy?
183
+ @mutex.synchronize { !@tasks.empty? || @stats[:in_flight].positive? }
184
+ end
185
+
176
186
  # Whether the queue is accepting new tasks.
177
187
  #
178
188
  # @return [Boolean]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Philiprehberger
4
4
  module TaskQueue
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
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.6.0
4
+ version: 0.7.0
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-05-07 00:00:00.000000000 Z
11
+ date: 2026-05-14 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.