zizq 0.4.0 → 0.5.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 +4 -4
- data/README.md +2 -2
- data/lib/zizq/client.rb +100 -7
- data/lib/zizq/query.rb +83 -0
- data/lib/zizq/version.rb +1 -1
- data/sig/generated/zizq/client.rbs +34 -3
- data/sig/generated/zizq/query.rbs +55 -2
- data/sig/generated/zizq/resources/page.rbs +1 -1
- data/sig/zizq.rbs +4 -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: 424b67e8dbba3c82506c24ed18cbaa9fc87af3febe9e079ef458f705e9299fdd
|
|
4
|
+
data.tar.gz: 53bc5f8b3aefbdddc69e2471e6efbd2ba7c84016cb8eb63ff16bc463107991fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10f7ab3fe215f04eff3c1753826734c609454c93f9c30c586dd0f38f49ac563d23dcb47317c12e7c00cde3dff558cb124ce0ae25a3c801b9b71a85ce806d96e9
|
|
7
|
+
data.tar.gz: 422601a65e9862a73360e036a0e5f44ac36bdcaa04a3fe585567e4fefaf9b73e4fa4736ac3fe9d0cc552173bcd9c47fef98cbc1a6935ef3a64870a839a5a13b9
|
data/README.md
CHANGED
|
@@ -33,13 +33,13 @@ API.
|
|
|
33
33
|
Add it to your application's `Gemfile`:
|
|
34
34
|
|
|
35
35
|
```ruby
|
|
36
|
-
gem 'zizq', '~> 0.
|
|
36
|
+
gem 'zizq', '~> 0.5.0'
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Or install it manually:
|
|
40
40
|
|
|
41
41
|
```shell
|
|
42
|
-
$ gem install zizq -v 0.
|
|
42
|
+
$ gem install zizq -v 0.5.0
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Ruby **3.2.8 or newer** is required. Client and server share version
|
data/lib/zizq/client.rb
CHANGED
|
@@ -238,11 +238,17 @@ module Zizq
|
|
|
238
238
|
# The `filter` parameter accepts a jq expression for filtering jobs by
|
|
239
239
|
# payload content (e.g. `.user_id == 42`).
|
|
240
240
|
#
|
|
241
|
+
# Range filters (`priority`, `attempts`, `ready_at`) accept exact values or
|
|
242
|
+
# inclusive ranges.
|
|
243
|
+
#
|
|
241
244
|
# @rbs id: (String | Array[String])?
|
|
242
245
|
# @rbs status: (String | Array[String])?
|
|
243
246
|
# @rbs queue: (String | Array[String])?
|
|
244
247
|
# @rbs type: (String | Array[String])?
|
|
245
248
|
# @rbs filter: String?
|
|
249
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
250
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
251
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
246
252
|
# @rbs from: String?
|
|
247
253
|
# @rbs order: Zizq::sort_direction?
|
|
248
254
|
# @rbs limit: Integer?
|
|
@@ -252,10 +258,25 @@ module Zizq
|
|
|
252
258
|
queue: nil,
|
|
253
259
|
type: nil,
|
|
254
260
|
filter: nil,
|
|
261
|
+
priority: nil,
|
|
262
|
+
ready_at: nil,
|
|
263
|
+
attempts: nil,
|
|
255
264
|
from: nil,
|
|
256
265
|
order: nil,
|
|
257
266
|
limit: nil)
|
|
258
|
-
options = {
|
|
267
|
+
options = {
|
|
268
|
+
id:,
|
|
269
|
+
status:,
|
|
270
|
+
queue:,
|
|
271
|
+
type:,
|
|
272
|
+
filter:,
|
|
273
|
+
priority: encode_range(priority),
|
|
274
|
+
ready_at: encode_range(ready_at) { |v| (v.to_f * 1000).to_i },
|
|
275
|
+
attempts: encode_range(attempts),
|
|
276
|
+
from:,
|
|
277
|
+
order:,
|
|
278
|
+
limit:,
|
|
279
|
+
}.compact #: Hash[Symbol, untyped]
|
|
259
280
|
|
|
260
281
|
multi_keys = %i[id status queue type]
|
|
261
282
|
params = build_where_params(options, multi_keys:)
|
|
@@ -280,13 +301,28 @@ module Zizq
|
|
|
280
301
|
# @rbs queue: (String | Array[String])?
|
|
281
302
|
# @rbs type: (String | Array[String])?
|
|
282
303
|
# @rbs filter: String?
|
|
304
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
305
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
306
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
283
307
|
# @rbs return: Integer
|
|
284
308
|
def count_jobs(id: nil,
|
|
285
309
|
status: nil,
|
|
286
310
|
queue: nil,
|
|
287
311
|
type: nil,
|
|
288
|
-
filter: nil
|
|
289
|
-
|
|
312
|
+
filter: nil,
|
|
313
|
+
priority: nil,
|
|
314
|
+
ready_at: nil,
|
|
315
|
+
attempts: nil)
|
|
316
|
+
options = {
|
|
317
|
+
id:,
|
|
318
|
+
status:,
|
|
319
|
+
queue:,
|
|
320
|
+
type:,
|
|
321
|
+
filter:,
|
|
322
|
+
priority: encode_range(priority),
|
|
323
|
+
ready_at: encode_range(ready_at) { |v| (v.to_f * 1000).to_i },
|
|
324
|
+
attempts: encode_range(attempts),
|
|
325
|
+
}.compact #: Hash[Symbol, untyped]
|
|
290
326
|
|
|
291
327
|
multi_keys = %i[id status queue type]
|
|
292
328
|
params = build_where_params(options, multi_keys:)
|
|
@@ -380,8 +416,12 @@ module Zizq
|
|
|
380
416
|
backoff: UNCHANGED,
|
|
381
417
|
retention: UNCHANGED)
|
|
382
418
|
body = build_set_body(
|
|
383
|
-
queue:,
|
|
384
|
-
|
|
419
|
+
queue:,
|
|
420
|
+
priority:,
|
|
421
|
+
ready_at:,
|
|
422
|
+
retry_limit:,
|
|
423
|
+
backoff:,
|
|
424
|
+
retention:
|
|
385
425
|
)
|
|
386
426
|
response = patch("/jobs/#{enc(id)}", body)
|
|
387
427
|
data = handle_response!(response, expected: 200)
|
|
@@ -926,9 +966,62 @@ module Zizq
|
|
|
926
966
|
# @rbs queue: (String | Array[String])?
|
|
927
967
|
# @rbs type: (String | Array[String])?
|
|
928
968
|
# @rbs filter: String?
|
|
969
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
970
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
971
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
929
972
|
# @rbs return: Hash[Symbol, untyped]
|
|
930
|
-
def validate_where(id: nil,
|
|
931
|
-
|
|
973
|
+
def validate_where(id: nil,
|
|
974
|
+
status: nil,
|
|
975
|
+
queue: nil,
|
|
976
|
+
type: nil,
|
|
977
|
+
filter: nil,
|
|
978
|
+
priority: nil,
|
|
979
|
+
ready_at: nil,
|
|
980
|
+
attempts: nil)
|
|
981
|
+
{
|
|
982
|
+
id:,
|
|
983
|
+
status:,
|
|
984
|
+
queue:,
|
|
985
|
+
type:,
|
|
986
|
+
filter:,
|
|
987
|
+
priority: encode_range(priority),
|
|
988
|
+
ready_at: encode_range(ready_at) { |v| (v.to_f * 1000).to_i },
|
|
989
|
+
attempts: encode_range(attempts),
|
|
990
|
+
}.compact
|
|
991
|
+
end
|
|
992
|
+
|
|
993
|
+
# Encode an Integer or Range filter into the server's query format.
|
|
994
|
+
#
|
|
995
|
+
# Accepted shapes:
|
|
996
|
+
#
|
|
997
|
+
# - `nil` -> `nil` (no filter sent)
|
|
998
|
+
# - `Integer` -> `"N"` (single value)
|
|
999
|
+
# - `(a..b)` -> `"A..B"` (inclusive both ends)
|
|
1000
|
+
# - `(a..)` -> `"A.."` (lower bound only)
|
|
1001
|
+
# - `(..b)` -> `"..B"` (upper bound only)
|
|
1002
|
+
#
|
|
1003
|
+
# Exclusive ranges (`a...b`, `a...`, `...b`) raise `ArgumentError` — the
|
|
1004
|
+
# server only supports inclusive bounds. A bound transformation block can
|
|
1005
|
+
# convert values before formatting (e.g. seconds -> ms for `ready_at`).
|
|
1006
|
+
#
|
|
1007
|
+
# @rbs value: untyped
|
|
1008
|
+
# @rbs &block: ?(untyped) -> Integer
|
|
1009
|
+
# @rbs return: String?
|
|
1010
|
+
def encode_range(value, &block)
|
|
1011
|
+
block ||= ->(v) { v.to_i }
|
|
1012
|
+
|
|
1013
|
+
case value
|
|
1014
|
+
when nil
|
|
1015
|
+
nil
|
|
1016
|
+
when Range
|
|
1017
|
+
if value.exclude_end?
|
|
1018
|
+
raise ArgumentError,
|
|
1019
|
+
"exclusive ranges are not supported by the server; use an inclusive range (a..b) instead"
|
|
1020
|
+
end
|
|
1021
|
+
"#{value.begin&.then(&block)}..#{value.end&.then(&block)}"
|
|
1022
|
+
else
|
|
1023
|
+
block.call(value).to_s
|
|
1024
|
+
end
|
|
932
1025
|
end
|
|
933
1026
|
|
|
934
1027
|
# Validate set parameters via keyword args (rejects unknown keys) and
|
data/lib/zizq/query.rb
CHANGED
|
@@ -55,6 +55,9 @@ module Zizq
|
|
|
55
55
|
# @rbs type: (String | Array[String])?
|
|
56
56
|
# @rbs status: (String | Array[String])?
|
|
57
57
|
# @rbs jq_filter: String?
|
|
58
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
59
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
60
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
58
61
|
# @rbs order: Zizq::sort_direction?
|
|
59
62
|
# @rbs limit: Integer?
|
|
60
63
|
# @rbs page_size: Integer?
|
|
@@ -64,6 +67,9 @@ module Zizq
|
|
|
64
67
|
type: nil,
|
|
65
68
|
status: nil,
|
|
66
69
|
jq_filter: nil,
|
|
70
|
+
priority: nil,
|
|
71
|
+
ready_at: nil,
|
|
72
|
+
attempts: nil,
|
|
67
73
|
order: nil,
|
|
68
74
|
limit: nil,
|
|
69
75
|
page_size: nil)
|
|
@@ -72,6 +78,9 @@ module Zizq
|
|
|
72
78
|
@type = type
|
|
73
79
|
@status = status
|
|
74
80
|
@jq_filter = jq_filter
|
|
81
|
+
@priority = priority
|
|
82
|
+
@ready_at = ready_at
|
|
83
|
+
@attempts = attempts
|
|
75
84
|
@order = order
|
|
76
85
|
@limit = limit
|
|
77
86
|
@page_size = page_size
|
|
@@ -153,6 +162,62 @@ module Zizq
|
|
|
153
162
|
rebuild(status: Array(@status) + Array(status))
|
|
154
163
|
end
|
|
155
164
|
|
|
165
|
+
# Filter by priority range (replaces any existing priority filter).
|
|
166
|
+
#
|
|
167
|
+
# Accepts an Integer (exact match) or an inclusive Range. Lower numbers
|
|
168
|
+
# are higher priority. Exclusive ranges (e.g. `0...100`) raise
|
|
169
|
+
# `ArgumentError` — the server only supports inclusive bounds.
|
|
170
|
+
#
|
|
171
|
+
# Examples:
|
|
172
|
+
#
|
|
173
|
+
# .by_priority(50) # exactly priority 50
|
|
174
|
+
# .by_priority(0..100) # between 0 and 100 inclusive
|
|
175
|
+
# .by_priority(100..) # 100 or greater
|
|
176
|
+
# .by_priority(..100) # 100 or less
|
|
177
|
+
#
|
|
178
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
179
|
+
# @rbs return: Query
|
|
180
|
+
def by_priority(priority)
|
|
181
|
+
rebuild(priority:)
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Filter by `ready_at` range (replaces any existing `ready_at` filter).
|
|
185
|
+
#
|
|
186
|
+
# Accepts a value (`Time`, `Numeric`, anything that responds to `to_f`)
|
|
187
|
+
# for an exact match, or an inclusive Range. Values are interpreted as
|
|
188
|
+
# fractional seconds on the Ruby side and converted to milliseconds for
|
|
189
|
+
# the server. Exclusive ranges raise `ArgumentError`.
|
|
190
|
+
#
|
|
191
|
+
# Examples:
|
|
192
|
+
#
|
|
193
|
+
# .by_ready_at(Time.now..) # ready to run now or later
|
|
194
|
+
# .by_ready_at(..Time.now) # was ready to run by now
|
|
195
|
+
# .by_ready_at(t1..t2) # ready between t1 and t2
|
|
196
|
+
#
|
|
197
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
198
|
+
# @rbs return: Query
|
|
199
|
+
def by_ready_at(ready_at)
|
|
200
|
+
rebuild(ready_at:)
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Filter by `attempts` range (replaces any existing `attempts` filter).
|
|
204
|
+
#
|
|
205
|
+
# Accepts an Integer (exact match) or an inclusive Range. `attempts` is
|
|
206
|
+
# the number of times the job has failed. Exclusive ranges raise
|
|
207
|
+
# `ArgumentError`.
|
|
208
|
+
#
|
|
209
|
+
# Examples:
|
|
210
|
+
#
|
|
211
|
+
# .by_attempts(0) # never failed
|
|
212
|
+
# .by_attempts(1..) # has failed at least once
|
|
213
|
+
# .by_attempts(1..3) # has failed 1, 2, or 3 times
|
|
214
|
+
#
|
|
215
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
216
|
+
# @rbs return: Query
|
|
217
|
+
def by_attempts(attempts)
|
|
218
|
+
rebuild(attempts:)
|
|
219
|
+
end
|
|
220
|
+
|
|
156
221
|
# Filter by job class and exact arguments.
|
|
157
222
|
#
|
|
158
223
|
# The job class must include `Zizq::Job` or for Active Job classes must
|
|
@@ -304,6 +369,9 @@ module Zizq
|
|
|
304
369
|
type: @type,
|
|
305
370
|
status: @status,
|
|
306
371
|
filter: @jq_filter,
|
|
372
|
+
priority: @priority,
|
|
373
|
+
ready_at: @ready_at,
|
|
374
|
+
attempts: @attempts,
|
|
307
375
|
)
|
|
308
376
|
|
|
309
377
|
@limit ? [total, @limit].min : total
|
|
@@ -421,6 +489,9 @@ module Zizq
|
|
|
421
489
|
type: @type,
|
|
422
490
|
status: @status,
|
|
423
491
|
filter: @jq_filter,
|
|
492
|
+
priority: @priority,
|
|
493
|
+
ready_at: @ready_at,
|
|
494
|
+
attempts: @attempts,
|
|
424
495
|
limit: [@page_size, @limit, (@page_size || @limit) && MAX_PAGE_SIZE].compact.min,
|
|
425
496
|
order: @order,
|
|
426
497
|
)
|
|
@@ -470,6 +541,9 @@ module Zizq
|
|
|
470
541
|
type: @type,
|
|
471
542
|
status: @status,
|
|
472
543
|
filter: @jq_filter,
|
|
544
|
+
priority: @priority,
|
|
545
|
+
ready_at: @ready_at,
|
|
546
|
+
attempts: @attempts,
|
|
473
547
|
}
|
|
474
548
|
|
|
475
549
|
apply = {
|
|
@@ -527,6 +601,9 @@ module Zizq
|
|
|
527
601
|
type: @type,
|
|
528
602
|
status: @status,
|
|
529
603
|
filter: @jq_filter,
|
|
604
|
+
priority: @priority,
|
|
605
|
+
ready_at: @ready_at,
|
|
606
|
+
attempts: @attempts,
|
|
530
607
|
}
|
|
531
608
|
|
|
532
609
|
if @limit || @page_size
|
|
@@ -564,6 +641,9 @@ module Zizq
|
|
|
564
641
|
type: @type,
|
|
565
642
|
status: @status,
|
|
566
643
|
jq_filter: @jq_filter,
|
|
644
|
+
priority: @priority,
|
|
645
|
+
ready_at: @ready_at,
|
|
646
|
+
attempts: @attempts,
|
|
567
647
|
order: @order,
|
|
568
648
|
limit: @limit,
|
|
569
649
|
page_size: @page_size)
|
|
@@ -573,6 +653,9 @@ module Zizq
|
|
|
573
653
|
type:,
|
|
574
654
|
status:,
|
|
575
655
|
jq_filter:,
|
|
656
|
+
priority:,
|
|
657
|
+
ready_at:,
|
|
658
|
+
attempts:,
|
|
576
659
|
limit:,
|
|
577
660
|
order:,
|
|
578
661
|
page_size:,
|
data/lib/zizq/version.rb
CHANGED
|
@@ -105,16 +105,22 @@ module Zizq
|
|
|
105
105
|
# The `filter` parameter accepts a jq expression for filtering jobs by
|
|
106
106
|
# payload content (e.g. `.user_id == 42`).
|
|
107
107
|
#
|
|
108
|
+
# Range filters (`priority`, `attempts`, `ready_at`) accept exact values or
|
|
109
|
+
# inclusive ranges.
|
|
110
|
+
#
|
|
108
111
|
# @rbs id: (String | Array[String])?
|
|
109
112
|
# @rbs status: (String | Array[String])?
|
|
110
113
|
# @rbs queue: (String | Array[String])?
|
|
111
114
|
# @rbs type: (String | Array[String])?
|
|
112
115
|
# @rbs filter: String?
|
|
116
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
117
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
118
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
113
119
|
# @rbs from: String?
|
|
114
120
|
# @rbs order: Zizq::sort_direction?
|
|
115
121
|
# @rbs limit: Integer?
|
|
116
122
|
# @rbs return: Resources::JobPage
|
|
117
|
-
def list_jobs: (?id: (String | Array[String])?, ?status: (String | Array[String])?, ?queue: (String | Array[String])?, ?type: (String | Array[String])?, ?filter: String?, ?from: String?, ?order: Zizq::sort_direction?, ?limit: Integer?) -> Resources::JobPage
|
|
123
|
+
def list_jobs: (?id: (String | Array[String])?, ?status: (String | Array[String])?, ?queue: (String | Array[String])?, ?type: (String | Array[String])?, ?filter: String?, ?priority: (Integer | Range[Integer?])?, ?ready_at: (Zizq::to_f | Range[Zizq::to_f?])?, ?attempts: (Integer | Range[Integer?])?, ?from: String?, ?order: Zizq::sort_direction?, ?limit: Integer?) -> Resources::JobPage
|
|
118
124
|
|
|
119
125
|
# Count jobs matching the given filters.
|
|
120
126
|
#
|
|
@@ -126,8 +132,11 @@ module Zizq
|
|
|
126
132
|
# @rbs queue: (String | Array[String])?
|
|
127
133
|
# @rbs type: (String | Array[String])?
|
|
128
134
|
# @rbs filter: String?
|
|
135
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
136
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
137
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
129
138
|
# @rbs return: Integer
|
|
130
|
-
def count_jobs: (?id: (String | Array[String])?, ?status: (String | Array[String])?, ?queue: (String | Array[String])?, ?type: (String | Array[String])?, ?filter: String?) -> Integer
|
|
139
|
+
def count_jobs: (?id: (String | Array[String])?, ?status: (String | Array[String])?, ?queue: (String | Array[String])?, ?type: (String | Array[String])?, ?filter: String?, ?priority: (Integer | Range[Integer?])?, ?ready_at: (Zizq::to_f | Range[Zizq::to_f?])?, ?attempts: (Integer | Range[Integer?])?) -> Integer
|
|
131
140
|
|
|
132
141
|
# Delete a single job by ID.
|
|
133
142
|
#
|
|
@@ -492,8 +501,30 @@ module Zizq
|
|
|
492
501
|
# @rbs queue: (String | Array[String])?
|
|
493
502
|
# @rbs type: (String | Array[String])?
|
|
494
503
|
# @rbs filter: String?
|
|
504
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
505
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
506
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
495
507
|
# @rbs return: Hash[Symbol, untyped]
|
|
496
|
-
def validate_where: (?id: (String | Array[String])?, ?status: (String | Array[String])?, ?queue: (String | Array[String])?, ?type: (String | Array[String])?, ?filter: String?) -> Hash[Symbol, untyped]
|
|
508
|
+
def validate_where: (?id: (String | Array[String])?, ?status: (String | Array[String])?, ?queue: (String | Array[String])?, ?type: (String | Array[String])?, ?filter: String?, ?priority: (Integer | Range[Integer?])?, ?ready_at: (Zizq::to_f | Range[Zizq::to_f?])?, ?attempts: (Integer | Range[Integer?])?) -> Hash[Symbol, untyped]
|
|
509
|
+
|
|
510
|
+
# Encode an Integer or Range filter into the server's query format.
|
|
511
|
+
#
|
|
512
|
+
# Accepted shapes:
|
|
513
|
+
#
|
|
514
|
+
# - `nil` -> `nil` (no filter sent)
|
|
515
|
+
# - `Integer` -> `"N"` (single value)
|
|
516
|
+
# - `(a..b)` -> `"A..B"` (inclusive both ends)
|
|
517
|
+
# - `(a..)` -> `"A.."` (lower bound only)
|
|
518
|
+
# - `(..b)` -> `"..B"` (upper bound only)
|
|
519
|
+
#
|
|
520
|
+
# Exclusive ranges (`a...b`, `a...`, `...b`) raise `ArgumentError` — the
|
|
521
|
+
# server only supports inclusive bounds. A bound transformation block can
|
|
522
|
+
# convert values before formatting (e.g. seconds -> ms for `ready_at`).
|
|
523
|
+
#
|
|
524
|
+
# @rbs value: untyped
|
|
525
|
+
# @rbs &block: ?(untyped) -> Integer
|
|
526
|
+
# @rbs return: String?
|
|
527
|
+
def encode_range: (untyped value) ?{ (untyped) -> Integer } -> String?
|
|
497
528
|
|
|
498
529
|
# Validate set parameters via keyword args (rejects unknown keys) and
|
|
499
530
|
# build the JSON body. Used by `update_all_jobs`.
|
|
@@ -46,11 +46,14 @@ module Zizq
|
|
|
46
46
|
# @rbs type: (String | Array[String])?
|
|
47
47
|
# @rbs status: (String | Array[String])?
|
|
48
48
|
# @rbs jq_filter: String?
|
|
49
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
50
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
51
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
49
52
|
# @rbs order: Zizq::sort_direction?
|
|
50
53
|
# @rbs limit: Integer?
|
|
51
54
|
# @rbs page_size: Integer?
|
|
52
55
|
# @rbs return: void
|
|
53
|
-
def initialize: (?id: (String | Array[String])?, ?queue: (String | Array[String])?, ?type: (String | Array[String])?, ?status: (String | Array[String])?, ?jq_filter: String?, ?order: Zizq::sort_direction?, ?limit: Integer?, ?page_size: Integer?) -> void
|
|
56
|
+
def initialize: (?id: (String | Array[String])?, ?queue: (String | Array[String])?, ?type: (String | Array[String])?, ?status: (String | Array[String])?, ?jq_filter: String?, ?priority: (Integer | Range[Integer?])?, ?ready_at: (Zizq::to_f | Range[Zizq::to_f?])?, ?attempts: (Integer | Range[Integer?])?, ?order: Zizq::sort_direction?, ?limit: Integer?, ?page_size: Integer?) -> void
|
|
54
57
|
|
|
55
58
|
# Set the page size for paginated iteration.
|
|
56
59
|
#
|
|
@@ -110,6 +113,56 @@ module Zizq
|
|
|
110
113
|
# @rbs return: Query
|
|
111
114
|
def add_status: (String | Array[String] status) -> Query
|
|
112
115
|
|
|
116
|
+
# Filter by priority range (replaces any existing priority filter).
|
|
117
|
+
#
|
|
118
|
+
# Accepts an Integer (exact match) or an inclusive Range. Lower numbers
|
|
119
|
+
# are higher priority. Exclusive ranges (e.g. `0...100`) raise
|
|
120
|
+
# `ArgumentError` — the server only supports inclusive bounds.
|
|
121
|
+
#
|
|
122
|
+
# Examples:
|
|
123
|
+
#
|
|
124
|
+
# .by_priority(50) # exactly priority 50
|
|
125
|
+
# .by_priority(0..100) # between 0 and 100 inclusive
|
|
126
|
+
# .by_priority(100..) # 100 or greater
|
|
127
|
+
# .by_priority(..100) # 100 or less
|
|
128
|
+
#
|
|
129
|
+
# @rbs priority: (Integer | Range[Integer?])?
|
|
130
|
+
# @rbs return: Query
|
|
131
|
+
def by_priority: ((Integer | Range[Integer?])? priority) -> Query
|
|
132
|
+
|
|
133
|
+
# Filter by `ready_at` range (replaces any existing `ready_at` filter).
|
|
134
|
+
#
|
|
135
|
+
# Accepts a value (`Time`, `Numeric`, anything that responds to `to_f`)
|
|
136
|
+
# for an exact match, or an inclusive Range. Values are interpreted as
|
|
137
|
+
# fractional seconds on the Ruby side and converted to milliseconds for
|
|
138
|
+
# the server. Exclusive ranges raise `ArgumentError`.
|
|
139
|
+
#
|
|
140
|
+
# Examples:
|
|
141
|
+
#
|
|
142
|
+
# .by_ready_at(Time.now..) # ready to run now or later
|
|
143
|
+
# .by_ready_at(..Time.now) # was ready to run by now
|
|
144
|
+
# .by_ready_at(t1..t2) # ready between t1 and t2
|
|
145
|
+
#
|
|
146
|
+
# @rbs ready_at: (Zizq::to_f | Range[Zizq::to_f?])?
|
|
147
|
+
# @rbs return: Query
|
|
148
|
+
def by_ready_at: ((Zizq::to_f | Range[Zizq::to_f?])? ready_at) -> Query
|
|
149
|
+
|
|
150
|
+
# Filter by `attempts` range (replaces any existing `attempts` filter).
|
|
151
|
+
#
|
|
152
|
+
# Accepts an Integer (exact match) or an inclusive Range. `attempts` is
|
|
153
|
+
# the number of times the job has failed. Exclusive ranges raise
|
|
154
|
+
# `ArgumentError`.
|
|
155
|
+
#
|
|
156
|
+
# Examples:
|
|
157
|
+
#
|
|
158
|
+
# .by_attempts(0) # never failed
|
|
159
|
+
# .by_attempts(1..) # has failed at least once
|
|
160
|
+
# .by_attempts(1..3) # has failed 1, 2, or 3 times
|
|
161
|
+
#
|
|
162
|
+
# @rbs attempts: (Integer | Range[Integer?])?
|
|
163
|
+
# @rbs return: Query
|
|
164
|
+
def by_attempts: ((Integer | Range[Integer?])? attempts) -> Query
|
|
165
|
+
|
|
113
166
|
# Filter by job class and exact arguments.
|
|
114
167
|
#
|
|
115
168
|
# The job class must include `Zizq::Job` or for Active Job classes must
|
|
@@ -332,7 +385,7 @@ module Zizq
|
|
|
332
385
|
# Build a new Query with the given overrides, preserving all other fields.
|
|
333
386
|
#
|
|
334
387
|
# @rbs return: Query
|
|
335
|
-
def rebuild: (?id: untyped, ?queue: untyped, ?type: untyped, ?status: untyped, ?jq_filter: untyped, ?order: untyped, ?limit: untyped, ?page_size: untyped) -> Query
|
|
388
|
+
def rebuild: (?id: untyped, ?queue: untyped, ?type: untyped, ?status: untyped, ?jq_filter: untyped, ?priority: untyped, ?ready_at: untyped, ?attempts: untyped, ?order: untyped, ?limit: untyped, ?page_size: untyped) -> Query
|
|
336
389
|
|
|
337
390
|
# @rbs job_class: untyped
|
|
338
391
|
# @rbs return: void
|
|
@@ -24,7 +24,7 @@ module Zizq
|
|
|
24
24
|
#
|
|
25
25
|
# @rbs &block: (T) -> void
|
|
26
26
|
# @rbs return: Enumerator[T, void] | void
|
|
27
|
-
def each: () { (T) -> void } ->
|
|
27
|
+
def each: () { (T) -> void } -> untyped
|
|
28
28
|
|
|
29
29
|
# Returns true if there is a next page that can be fetched.
|
|
30
30
|
def has_next?: () -> untyped
|
data/sig/zizq.rbs
CHANGED
|
@@ -32,7 +32,10 @@ module Zizq
|
|
|
32
32
|
?status: (String | Array[String])?,
|
|
33
33
|
?queue: (String | Array[String])?,
|
|
34
34
|
?type: (String | Array[String])?,
|
|
35
|
-
?filter: String
|
|
35
|
+
?filter: String?,
|
|
36
|
+
?priority: (Integer | Range[Integer?])?,
|
|
37
|
+
?ready_at: (to_f | Range[to_f?])?,
|
|
38
|
+
?attempts: (Integer | Range[Integer?])?
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
# Update parameters for single and bulk update operations.
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zizq
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Corbyn <chris@zizq.io>
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-06-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: async-http
|