sidekiq-batch-jobs 0.3.0 → 0.3.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 +27 -0
- data/app/models/sidekiq_batch/jid_index.rb +21 -5
- data/lib/sidekiq/batch/jobs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f4d7393e0ca05c738c5714bd6cf5da53a0d52995d52b37560a5e6385cb88ff6
|
|
4
|
+
data.tar.gz: dfac8100fb929a8f97268bcc8f40c229e1753b0f43921d0a523ec14137525681
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a91c9a60b67597c4535f435c349a76dcfe75820e831def7e8085798a8c3be02e06e309082d5f1afef4a0221ff05a3d453e9b855f088b4530eaff006d31e170c
|
|
7
|
+
data.tar.gz: 1b1a1180879ecbda260d36763c087705e93e7dfbd867203d61c9ba3b8ba2b4e1787df1f31c5337940a4f9ab9e846cb9aacf3fdbf186f3cbbdf3c5525789b0146
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,33 @@ All notable changes to this project are documented here.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.1] - 2026-09-08
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **The reaper could fail jobs that were still running.** `JidIndex` read an executing job's id
|
|
13
|
+
as `work.payload["jid"]`, but `payload` holds the job as a JSON *string* rather than a nested
|
|
14
|
+
object, so that expression is String indexing: it finds the key *name* in the JSON and returns
|
|
15
|
+
the literal `"jid"`, for every job on the cluster. The live-jid index filled with a single
|
|
16
|
+
constant, no executing job was ever found in it, and `StuckJobReaper` marked rows orphaned
|
|
17
|
+
whose jobs were running perfectly well. Unrecoverable once it happened, since the job's own
|
|
18
|
+
`complete!` then finds the row no longer pending and leaves it failed.
|
|
19
|
+
|
|
20
|
+
Reaching it took a batch quiet for `stuck_after` (two hours by default), so the exposure was
|
|
21
|
+
long-running jobs, which is much of what batches are for. Present since 0.1.0.
|
|
22
|
+
|
|
23
|
+
The example covering this branch built its Redis fixture with a nested Hash, a shape no
|
|
24
|
+
Sidekiq version writes, so it passed throughout. It now writes the string form, alongside one
|
|
25
|
+
example pinning that shape and one asserting the literal `"jid"` never reaches the index.
|
|
26
|
+
|
|
27
|
+
- **`JidIndex` raised `NoMethodError` on Sidekiq 7.0 to 7.2.** `WorkSet` yielded a raw Hash
|
|
28
|
+
until 7.3 and a `Sidekiq::Work` since, and the code called `#payload` on whatever it got. The
|
|
29
|
+
gemspec has always allowed `sidekiq >= 7.0`, and every CI lane resolves 7.3 or newer, so no
|
|
30
|
+
lane exercised the older shape. Both are now read through `Sidekiq::JobRecord`, which
|
|
31
|
+
normalises the string and hash forms the way `Sidekiq::Work#job` does.
|
|
32
|
+
|
|
33
|
+
No schema change, so nothing to migrate.
|
|
34
|
+
|
|
8
35
|
## [0.3.0] - 2026-09-07
|
|
9
36
|
|
|
10
37
|
### Breaking
|
|
@@ -34,12 +34,28 @@ class SidekiqBatch
|
|
|
34
34
|
end
|
|
35
35
|
private_class_method :add_sorted_sets
|
|
36
36
|
|
|
37
|
+
# Two shapes to survive here, and reading either one naively is silently
|
|
38
|
+
# wrong rather than loud.
|
|
39
|
+
#
|
|
40
|
+
# `payload` holds the job as a JSON *string*, not a nested object: the
|
|
41
|
+
# processor stores `{queue:, payload: jobstr, run_at:}`. So `payload["jid"]`
|
|
42
|
+
# is String indexing, which finds the key *name* in the JSON and returns the
|
|
43
|
+
# literal "jid" for every job on the cluster. The index fills with one
|
|
44
|
+
# constant, no executing job is ever found in it, and StuckJobReaper fails
|
|
45
|
+
# rows whose jobs are running perfectly well.
|
|
46
|
+
#
|
|
47
|
+
# The container around it moved too: WorkSet yielded a raw Hash until 7.3,
|
|
48
|
+
# and a Sidekiq::Work since. This gem supports both.
|
|
49
|
+
#
|
|
50
|
+
# JobRecord is Sidekiq's own reader for a job, and normalises the string and
|
|
51
|
+
# hash forms of a payload the same way `Sidekiq::Work#job` does.
|
|
37
52
|
def self.add_executing(jids)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
53
|
+
::Sidekiq::WorkSet.new.each do |_process_id, _thread_id, work|
|
|
54
|
+
payload = work.respond_to?(:payload) ? work.payload : work["payload"]
|
|
55
|
+
|
|
56
|
+
next unless payload
|
|
57
|
+
|
|
58
|
+
jid = ::Sidekiq::JobRecord.new(payload).jid
|
|
43
59
|
|
|
44
60
|
jids << jid if jid
|
|
45
61
|
end
|