sidekiq 7.0.4 → 7.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sidekiq might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Changes.md +6 -1
- data/lib/sidekiq/job_util.rb +37 -9
- data/lib/sidekiq/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: fec40f38a40f555d39f3826d0b2b26dd72d500a8e58a35ff2e85436ad5abb2c7
|
4
|
+
data.tar.gz: b6b0fde1518951d5715484a046e0732224f819b6c45dba1e18c02e8292b97f55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6e0d60356029b73764a1e57e3e6e570fa8e56758da14f6a16945f502f694d182f71e34b246eed4aaa022b184214f7da8253292deeb3b7540bcf14030b3a1139
|
7
|
+
data.tar.gz: 3b03e4b1373288faceaee25ac08e73da00f3923bbbfd925b5b02dc0af6ec0c37fb7d23a14b6ec90be268df0441b974e100aa07462586b41648126d3b4020460a
|
data/Changes.md
CHANGED
@@ -2,7 +2,12 @@
|
|
2
2
|
|
3
3
|
[Sidekiq Changes](https://github.com/sidekiq/sidekiq/blob/main/Changes.md) | [Sidekiq Pro Changes](https://github.com/sidekiq/sidekiq/blob/main/Pro-Changes.md) | [Sidekiq Enterprise Changes](https://github.com/sidekiq/sidekiq/blob/main/Ent-Changes.md)
|
4
4
|
|
5
|
-
|
5
|
+
7.0.5
|
6
|
+
----------
|
7
|
+
|
8
|
+
- More context for debugging json unsafe errors [#5787]
|
9
|
+
|
10
|
+
7.0.4
|
6
11
|
----------
|
7
12
|
|
8
13
|
- Performance and memory optimizations [#5768, fatkodima]
|
data/lib/sidekiq/job_util.rb
CHANGED
@@ -17,19 +17,24 @@ module Sidekiq
|
|
17
17
|
|
18
18
|
def verify_json(item)
|
19
19
|
job_class = item["wrapped"] || item["class"]
|
20
|
-
|
21
|
-
|
20
|
+
args = item["args"]
|
21
|
+
mode = Sidekiq::Config::DEFAULTS[:on_complex_arguments]
|
22
|
+
|
23
|
+
if mode == :raise || mode == :warn
|
24
|
+
unless json_safe?(args)
|
25
|
+
unsafe_item = json_unsafe_item(args)
|
22
26
|
msg = <<~EOM
|
23
|
-
Job arguments to #{job_class} must be native JSON types,
|
27
|
+
Job arguments to #{job_class} must be native JSON types, but #{unsafe_item.inspect} is a #{unsafe_item.class}.
|
28
|
+
See https://github.com/sidekiq/sidekiq/wiki/Best-Practices.
|
24
29
|
To disable this error, add `Sidekiq.strict_args!(false)` to your initializer.
|
25
30
|
EOM
|
26
|
-
|
31
|
+
|
32
|
+
if mode == :raise
|
33
|
+
raise(ArgumentError, msg)
|
34
|
+
else
|
35
|
+
warn(msg)
|
36
|
+
end
|
27
37
|
end
|
28
|
-
elsif Sidekiq::Config::DEFAULTS[:on_complex_arguments] == :warn
|
29
|
-
warn <<~EOM unless json_safe?(item["args"])
|
30
|
-
Job arguments to #{job_class} must be native JSON types, see https://github.com/sidekiq/sidekiq/wiki/Best-Practices.
|
31
|
-
To disable this warning, add `Sidekiq.strict_args!(false)` to your initializer.
|
32
|
-
EOM
|
33
38
|
end
|
34
39
|
end
|
35
40
|
|
@@ -87,5 +92,28 @@ module Sidekiq
|
|
87
92
|
def json_safe?(item)
|
88
93
|
RECURSIVE_JSON_SAFE[item.class].call(item)
|
89
94
|
end
|
95
|
+
|
96
|
+
def json_unsafe_item(item)
|
97
|
+
case item
|
98
|
+
when String, Integer, Float, TrueClass, FalseClass, NilClass
|
99
|
+
nil
|
100
|
+
when Array
|
101
|
+
item.each do |e|
|
102
|
+
unsafe_item = json_unsafe_item(e)
|
103
|
+
return unsafe_item unless unsafe_item.nil?
|
104
|
+
end
|
105
|
+
nil
|
106
|
+
when Hash
|
107
|
+
item.each do |k, v|
|
108
|
+
return k unless String === k
|
109
|
+
|
110
|
+
unsafe_item = json_unsafe_item(v)
|
111
|
+
return unsafe_item unless unsafe_item.nil?
|
112
|
+
end
|
113
|
+
nil
|
114
|
+
else
|
115
|
+
item
|
116
|
+
end
|
117
|
+
end
|
90
118
|
end
|
91
119
|
end
|
data/lib/sidekiq/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Perham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|