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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -0
- data/lib/philiprehberger/task_queue/queue.rb +9 -0
- data/lib/philiprehberger/task_queue/version.rb +1 -1
- 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: 829177cbd19c6b70ce4e32d03b824d80e0757d833f0f222ed7336156c2491975
|
|
4
|
+
data.tar.gz: 28a1317702057efb8effe2053a5c1b531bc7c13aff26dae835217a5da82d10b8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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]
|
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.
|
|
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-
|
|
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.
|