sidekiq 7.1.0 → 7.1.1
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 +13 -0
- data/lib/sidekiq/api.rb +4 -4
- data/lib/sidekiq/cli.rb +1 -0
- data/lib/sidekiq/config.rb +1 -1
- data/lib/sidekiq/middleware/current_attributes.rb +55 -16
- 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: a5a020fb72399ae30db922c2c39fe63932c6a0f0ca2094c39d809df18b448331
|
4
|
+
data.tar.gz: 50e6dfc4ab7db79279463fc70cc52226e7fe1a58188b6a0f3f2a774b76428a76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 169a24acd3011faf7d449f7fbf08d2e62125f0802791afdac7db992950ffdf53e768bc6549ccdd46e1868b07c5b367cb574be613704b7da658927d21b75bb320
|
7
|
+
data.tar.gz: 165d6d1fb808f53731ff460c992bc5103bb0f66e619a9aed22561aee9c21e09fc59d8f1f388e52acde68eefdf81413953bd1dda6bf32ded0dbd9980a247a12e4
|
data/Changes.md
CHANGED
@@ -2,6 +2,14 @@
|
|
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
|
+
7.1.1
|
6
|
+
----------
|
7
|
+
|
8
|
+
- Support multiple CurrentAttributes [#5904]
|
9
|
+
- Speed up latency fetch with large queues on Redis <7 [#5910]
|
10
|
+
- Allow a larger default client pool [#5886]
|
11
|
+
- Ensure Sidekiq.options[:environment] == RAILS_ENV [#5932]
|
12
|
+
|
5
13
|
7.1.0
|
6
14
|
----------
|
7
15
|
|
@@ -101,6 +109,11 @@ end
|
|
101
109
|
- Job Execution metrics!!!
|
102
110
|
- See `docs/7.0-Upgrade.md` for release notes
|
103
111
|
|
112
|
+
6.5.9
|
113
|
+
----------
|
114
|
+
|
115
|
+
- Ensure Sidekiq.options[:environment] == RAILS_ENV [#5932]
|
116
|
+
|
104
117
|
6.5.8
|
105
118
|
----------
|
106
119
|
|
data/lib/sidekiq/api.rb
CHANGED
@@ -92,11 +92,11 @@ module Sidekiq
|
|
92
92
|
pipeline.zcard("retry")
|
93
93
|
pipeline.zcard("dead")
|
94
94
|
pipeline.scard("processes")
|
95
|
-
pipeline.
|
95
|
+
pipeline.lindex("queue:default", -1)
|
96
96
|
end
|
97
97
|
}
|
98
98
|
|
99
|
-
default_queue_latency = if (entry = pipe1_res[6]
|
99
|
+
default_queue_latency = if (entry = pipe1_res[6])
|
100
100
|
job = begin
|
101
101
|
Sidekiq.load_json(entry)
|
102
102
|
rescue
|
@@ -264,8 +264,8 @@ module Sidekiq
|
|
264
264
|
# @return [Float] in seconds
|
265
265
|
def latency
|
266
266
|
entry = Sidekiq.redis { |conn|
|
267
|
-
conn.
|
268
|
-
}
|
267
|
+
conn.lindex(@rname, -1)
|
268
|
+
}
|
269
269
|
return 0 unless entry
|
270
270
|
job = Sidekiq.load_json(entry)
|
271
271
|
now = Time.now.to_f
|
data/lib/sidekiq/cli.rb
CHANGED
@@ -230,6 +230,7 @@ module Sidekiq # :nodoc:
|
|
230
230
|
# Both Sinatra 2.0+ and Sidekiq support this term.
|
231
231
|
# RAILS_ENV and RACK_ENV are there for legacy support.
|
232
232
|
@environment = cli_env || ENV["APP_ENV"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
|
233
|
+
config[:environment] = @environment
|
233
234
|
end
|
234
235
|
|
235
236
|
def symbolize_keys_deep!(hash)
|
data/lib/sidekiq/config.rb
CHANGED
@@ -127,7 +127,7 @@ module Sidekiq
|
|
127
127
|
private def local_redis_pool
|
128
128
|
# this is our internal client/housekeeping pool. each capsule has its
|
129
129
|
# own pool for executing threads.
|
130
|
-
@redis ||= new_redis_pool(
|
130
|
+
@redis ||= new_redis_pool(10, "internal")
|
131
131
|
end
|
132
132
|
|
133
133
|
def new_redis_pool(size, name = "unset")
|
@@ -7,26 +7,32 @@ module Sidekiq
|
|
7
7
|
# This can be useful for multi-tenancy, i18n locale, timezone, any implicit
|
8
8
|
# per-request attribute. See +ActiveSupport::CurrentAttributes+.
|
9
9
|
#
|
10
|
+
# For multiple current attributes, pass an array of current attributes.
|
11
|
+
#
|
10
12
|
# @example
|
11
13
|
#
|
12
14
|
# # in your initializer
|
13
15
|
# require "sidekiq/middleware/current_attributes"
|
14
16
|
# Sidekiq::CurrentAttributes.persist("Myapp::Current")
|
17
|
+
# # or multiple current attributes
|
18
|
+
# Sidekiq::CurrentAttributes.persist(["Myapp::Current", "Myapp::OtherCurrent"])
|
15
19
|
#
|
16
20
|
module CurrentAttributes
|
17
21
|
class Save
|
18
22
|
include Sidekiq::ClientMiddleware
|
19
23
|
|
20
|
-
def initialize(
|
21
|
-
@
|
24
|
+
def initialize(cattrs)
|
25
|
+
@cattrs = cattrs
|
22
26
|
end
|
23
27
|
|
24
28
|
def call(_, job, _, _)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
@cattrs.each do |(key, strklass)|
|
30
|
+
if !job.has_key?(key)
|
31
|
+
attrs = strklass.constantize.attributes
|
32
|
+
# Retries can push the job N times, we don't
|
33
|
+
# want retries to reset cattr. #5692, #5090
|
34
|
+
job[key] = attrs if attrs.any?
|
35
|
+
end
|
30
36
|
end
|
31
37
|
yield
|
32
38
|
end
|
@@ -35,22 +41,55 @@ module Sidekiq
|
|
35
41
|
class Load
|
36
42
|
include Sidekiq::ServerMiddleware
|
37
43
|
|
38
|
-
def initialize(
|
39
|
-
@
|
44
|
+
def initialize(cattrs)
|
45
|
+
@cattrs = cattrs
|
40
46
|
end
|
41
47
|
|
42
48
|
def call(_, job, _, &block)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
49
|
+
cattrs_to_reset = []
|
50
|
+
|
51
|
+
@cattrs.each do |(key, strklass)|
|
52
|
+
if job.has_key?(key)
|
53
|
+
constklass = strklass.constantize
|
54
|
+
cattrs_to_reset << constklass
|
55
|
+
|
56
|
+
job[key].each do |(attribute, value)|
|
57
|
+
constklass.public_send("#{attribute}=", value)
|
58
|
+
end
|
59
|
+
end
|
47
60
|
end
|
61
|
+
|
62
|
+
yield
|
63
|
+
ensure
|
64
|
+
cattrs_to_reset.each(&:reset)
|
48
65
|
end
|
49
66
|
end
|
50
67
|
|
51
|
-
|
52
|
-
|
53
|
-
|
68
|
+
class << self
|
69
|
+
def persist(klass_or_array, config = Sidekiq.default_configuration)
|
70
|
+
cattrs = build_cattrs_hash(klass_or_array)
|
71
|
+
|
72
|
+
config.client_middleware.add Save, cattrs
|
73
|
+
config.server_middleware.add Load, cattrs
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def build_cattrs_hash(klass_or_array)
|
79
|
+
if klass_or_array.is_a?(Array)
|
80
|
+
{}.tap do |hash|
|
81
|
+
klass_or_array.each_with_index do |klass, index|
|
82
|
+
hash[key_at(index)] = klass.to_s
|
83
|
+
end
|
84
|
+
end
|
85
|
+
else
|
86
|
+
{key_at(0) => klass_or_array.to_s}
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def key_at(index)
|
91
|
+
(index == 0) ? "cattr" : "cattr_#{index}"
|
92
|
+
end
|
54
93
|
end
|
55
94
|
end
|
56
95
|
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.1.
|
4
|
+
version: 7.1.1
|
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-05-
|
11
|
+
date: 2023-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|