zizq 0.3.6 → 0.3.7
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 +3 -3
- data/lib/zizq/test/client.rb +20 -2
- data/lib/zizq/test.rb +7 -1
- data/lib/zizq/version.rb +1 -1
- data/sig/generated/zizq/test/client.rbs +14 -0
- 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: 3252547a350b856e8122d15a77275769f62a4495efe36b36e252eba2246b51cf
|
|
4
|
+
data.tar.gz: 570e3ef065cbe42cfc038d6c1dd6669940d62f051d53965c48bea548f329e941
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 545bc4510f7df1acc51817c48ec2fae04c3a96df3589c2e3f12017d8bebb311a69cd7d18b14941ed3206829d08dd1cf28dd1d0461d44c7d2a265eead57f70710
|
|
7
|
+
data.tar.gz: 00b8916adf6921aded73d0f16cde1c2c52c98f338b3a9e4ad79a4131f06aef42b4001623c2e43d53a7c9d67e289c62f97b6abfbee6b0bb240ed89726e273ae7e
|
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.3.
|
|
36
|
+
gem 'zizq', '~> 0.3.7'
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
Or install it manually:
|
|
40
40
|
|
|
41
41
|
```shell
|
|
42
|
-
$ gem install zizq -v 0.3.
|
|
42
|
+
$ gem install zizq -v 0.3.7
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Ruby **3.2.8 or newer** is required. Client and server share version
|
|
@@ -161,7 +161,7 @@ Zizq.enqueue_raw(
|
|
|
161
161
|
)
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
### Cross-language and low-level dispatch
|
|
164
|
+
### Cross-language and low-level dispatch
|
|
165
165
|
|
|
166
166
|
When a Ruby app needs to *process* jobs enqueued by another language
|
|
167
167
|
(or by `Zizq.enqueue_raw`), `Zizq::Router` maps `type` strings to
|
data/lib/zizq/test/client.rb
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
# rbs_inline: enabled
|
|
5
5
|
# frozen_string_literal: true
|
|
6
6
|
|
|
7
|
+
require "json"
|
|
8
|
+
|
|
7
9
|
module Zizq
|
|
8
10
|
module Test
|
|
9
11
|
# A `Zizq::Client` stand-in for use in test suites.
|
|
@@ -143,7 +145,7 @@ module Zizq
|
|
|
143
145
|
req = EnqueueRequest.new(
|
|
144
146
|
queue:,
|
|
145
147
|
type:,
|
|
146
|
-
payload
|
|
148
|
+
payload: self.class.normalize_payload(payload),
|
|
147
149
|
priority:,
|
|
148
150
|
ready_at:,
|
|
149
151
|
retry_limit:,
|
|
@@ -162,7 +164,7 @@ module Zizq
|
|
|
162
164
|
req = EnqueueRequest.new(
|
|
163
165
|
queue: params[:queue],
|
|
164
166
|
type: params[:type],
|
|
165
|
-
payload: params[:payload],
|
|
167
|
+
payload: self.class.normalize_payload(params[:payload]),
|
|
166
168
|
priority: params[:priority],
|
|
167
169
|
ready_at: params[:ready_at],
|
|
168
170
|
retry_limit: params[:retry_limit],
|
|
@@ -236,6 +238,22 @@ module Zizq
|
|
|
236
238
|
"#{ID_PREFIX}#{counter.to_s.rjust(ID_LENGTH - ID_PREFIX.length, '0')}"
|
|
237
239
|
end
|
|
238
240
|
|
|
241
|
+
public
|
|
242
|
+
|
|
243
|
+
# Round-trip the payload through JSON so the in-memory
|
|
244
|
+
# representation matches what a consumer would receive over the
|
|
245
|
+
# wire: symbol keys / Symbol values become strings, nested
|
|
246
|
+
# hashes and arrays are normalized recursively, and non-JSON-
|
|
247
|
+
# safe values (BigDecimal, custom objects) raise here rather
|
|
248
|
+
# than surviving in test mode only to break in production.
|
|
249
|
+
#
|
|
250
|
+
# Also used by `Zizq::Test.enqueued_raw?` / `enqueued_raw_count`
|
|
251
|
+
# to normalize the query side so symbol-keyed assertion payloads
|
|
252
|
+
# still match the (now string-keyed) buffer.
|
|
253
|
+
def self.normalize_payload(payload) #: (untyped) -> untyped
|
|
254
|
+
JSON.parse(JSON.generate(payload))
|
|
255
|
+
end
|
|
256
|
+
|
|
239
257
|
# Returns entries matching every named filter AND the predicate.
|
|
240
258
|
# All filter kwargs are optional; unset means "don't filter on
|
|
241
259
|
# this axis." Callers must hold `@mutex` — public accessors do
|
data/lib/zizq/test.rb
CHANGED
|
@@ -168,7 +168,13 @@ module Zizq
|
|
|
168
168
|
filters = {}
|
|
169
169
|
filters[:only_queues] = queue if queue
|
|
170
170
|
filters[:only_types] = type if type
|
|
171
|
-
|
|
171
|
+
unless payload.nil?
|
|
172
|
+
# Normalize the assertion-side payload the same way enqueue
|
|
173
|
+
# normalizes the buffered one, so symbol-keyed test payloads
|
|
174
|
+
# still match the (string-keyed) wire-format buffer.
|
|
175
|
+
normalized = Client.normalize_payload(payload)
|
|
176
|
+
filters[:filter] = ->(job) { job.payload == normalized }
|
|
177
|
+
end
|
|
172
178
|
client.enqueued_jobs(**filters).size
|
|
173
179
|
end
|
|
174
180
|
|
data/lib/zizq/version.rb
CHANGED
|
@@ -120,6 +120,20 @@ module Zizq
|
|
|
120
120
|
|
|
121
121
|
def synthetic_id: (untyped counter) -> untyped
|
|
122
122
|
|
|
123
|
+
public
|
|
124
|
+
|
|
125
|
+
# Round-trip the payload through JSON so the in-memory
|
|
126
|
+
# representation matches what a consumer would receive over the
|
|
127
|
+
# wire: symbol keys / Symbol values become strings, nested
|
|
128
|
+
# hashes and arrays are normalized recursively, and non-JSON-
|
|
129
|
+
# safe values (BigDecimal, custom objects) raise here rather
|
|
130
|
+
# than surviving in test mode only to break in production.
|
|
131
|
+
#
|
|
132
|
+
# Also used by `Zizq::Test.enqueued_raw?` / `enqueued_raw_count`
|
|
133
|
+
# to normalize the query side so symbol-keyed assertion payloads
|
|
134
|
+
# still match the (now string-keyed) buffer.
|
|
135
|
+
def self.normalize_payload: (untyped payload) -> untyped
|
|
136
|
+
|
|
123
137
|
# Returns entries matching every named filter AND the predicate.
|
|
124
138
|
# All filter kwargs are optional; unset means "don't filter on
|
|
125
139
|
# this axis." Callers must hold `@mutex` — public accessors do
|
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.3.
|
|
4
|
+
version: 0.3.7
|
|
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-05-
|
|
11
|
+
date: 2026-05-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: async-http
|