sidekiq-delay_extensions 6.4.1 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changes.md +16 -1
- data/Gemfile +15 -9
- data/README.md +18 -11
- data/lib/sidekiq/delay_extensions/action_mailer.rb +1 -1
- data/lib/sidekiq/delay_extensions/active_record.rb +1 -1
- data/lib/sidekiq/delay_extensions/api.rb +26 -11
- data/lib/sidekiq/delay_extensions/class_methods.rb +1 -1
- data/lib/sidekiq/delay_extensions/generic_proxy.rb +1 -1
- data/lib/sidekiq/delay_extensions/testing.rb +17 -2
- data/lib/sidekiq/delay_extensions/version.rb +1 -1
- data/sidekiq-delay_extensions.gemspec +4 -4
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95dda38ae3c61ad156898807a993f2e4ed94a1e9fa84e0acefc55e9eda8c563f
|
4
|
+
data.tar.gz: c01d2df0317cb993a90ea42edf54c8cd8555a47abc6e9fc5aeca30cd3c609970
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8ff4ae1215e5f1feb5b69c776711e9bdbd788d485d67f539e6b04aa47712149eff81f3a8148ad18fde812254107d1954754e67559847821cfd22cb414d64321
|
7
|
+
data.tar.gz: 1c829791c9f5c30a59fd236864f07d9e3ae635bd928bc4df8d25bce692b1323f0a8f851692d49cafac4da446b8c87b4f84d8d33fcfe8e8151201f5de7ade08a4
|
data/Changes.md
CHANGED
@@ -1,8 +1,23 @@
|
|
1
1
|
# Sidekiq Delay Extensions Changes
|
2
2
|
|
3
|
-
[Sidekiq
|
3
|
+
[See Sidekiq for its changes](https://github.com/mperham/sidekiq/blob/main/Changes.md)
|
4
|
+
|
5
|
+
7.0.0
|
6
|
+
---------
|
7
|
+
|
8
|
+
- Require Sidekiq >= 7.0
|
9
|
+
|
10
|
+
6.5.12
|
11
|
+
---------
|
12
|
+
|
13
|
+
- Extracted from https://github.com/mperham/sidekiq/tree/v6.5.12
|
4
14
|
|
5
15
|
6.4.1
|
6
16
|
---------
|
7
17
|
|
8
18
|
- Extracted from https://github.com/mperham/sidekiq/tree/v6.4.1
|
19
|
+
|
20
|
+
6.4.0
|
21
|
+
---------
|
22
|
+
|
23
|
+
- Extracted from https://github.com/mperham/sidekiq/tree/v6.4.0
|
data/Gemfile
CHANGED
@@ -2,20 +2,26 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem "sidekiq", "
|
5
|
+
gem "sidekiq", "~> 7.0"
|
6
6
|
gem "rake"
|
7
|
-
|
8
|
-
gem "
|
7
|
+
RAILS_VERSION = "~> 7.0.4"
|
8
|
+
gem "actionmailer", RAILS_VERSION
|
9
|
+
gem "actionpack", RAILS_VERSION
|
10
|
+
gem "activejob", RAILS_VERSION
|
11
|
+
gem "activerecord", RAILS_VERSION
|
12
|
+
gem "railties", RAILS_VERSION
|
13
|
+
gem "redis-client"
|
14
|
+
# gem "bumbler"
|
15
|
+
# gem "debug"
|
16
|
+
|
9
17
|
gem "sqlite3", platforms: :ruby
|
10
18
|
gem "activerecord-jdbcsqlite3-adapter", platforms: :jruby
|
11
|
-
|
12
|
-
|
13
|
-
gem "net-smtp", platforms: :mri, require: false
|
19
|
+
gem "after_commit_everywhere", require: false
|
20
|
+
gem "yard"
|
14
21
|
|
15
22
|
group :test do
|
16
|
-
gem "
|
23
|
+
gem "maxitest"
|
17
24
|
gem "simplecov"
|
18
|
-
gem "codecov", require: false
|
19
25
|
end
|
20
26
|
|
21
27
|
group :development, :test do
|
@@ -23,6 +29,6 @@ group :development, :test do
|
|
23
29
|
end
|
24
30
|
|
25
31
|
group :load_test do
|
26
|
-
gem "hiredis"
|
27
32
|
gem "toxiproxy"
|
33
|
+
gem "ruby-prof"
|
28
34
|
end
|
data/README.md
CHANGED
@@ -2,33 +2,40 @@ Sidekiq Delay Extensions
|
|
2
2
|
==============
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/sidekiq-delay_extensions.svg)](https://rubygems.org/gems/sidekiq-delay_extensions)
|
5
|
-
![Build](https://github.com/
|
5
|
+
![Build](https://github.com/gemhome/sidekiq-delay_extensions/workflows/CI/badge.svg)
|
6
6
|
|
7
|
-
The [Sidekiq delay extensions
|
7
|
+
The [Sidekiq delay extensions were deprecated in 6.x and were removed from 7.x](https://github.com/mperham/sidekiq/issues/5076).
|
8
8
|
|
9
|
-
This gem extracts the delay extensions from the latest 6.x release
|
10
|
-
|
9
|
+
This gem extracts the delay extensions from the latest 6.x release, 6.5.12.
|
10
|
+
Version 7.x of this gem will maintain compatibility with Sidekiq 7.x.
|
11
11
|
|
12
|
-
|
12
|
+
This gem is maintained independent of Sidekiq. Maintainers wanted.
|
13
13
|
|
14
14
|
Requirements
|
15
15
|
-----------------
|
16
16
|
|
17
|
-
- See https://github.com/
|
18
|
-
- Redis:
|
19
|
-
- Ruby: MRI 2.
|
20
|
-
- Sidekiq
|
17
|
+
- See https://github.com/sidekiq/sidekiq/blob/main/Changes.md#700
|
18
|
+
- Redis: 6.2+
|
19
|
+
- Ruby: MRI 2.7+ or JRuby 9.3+.
|
20
|
+
- Sidekiq 7.0 supports Rails 6.0+ but does not require it.
|
21
21
|
|
22
22
|
Installation
|
23
23
|
-----------------
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
bundle add sidekiq
|
26
|
+
bundle add sidekiq-delay_extensions
|
27
27
|
|
28
28
|
In your initializers, include the line:
|
29
29
|
|
30
30
|
Sidekiq::DelayExtensions.enable_delay!
|
31
31
|
|
32
|
+
Upgrading (IMPORTANT): Also add
|
33
|
+
|
34
|
+
# To handle any existing delayed jobs at time of upgrade.
|
35
|
+
Sidekiq::Extensions::DelayedClass = Sidekiq::DelayExtensions::DelayedClass
|
36
|
+
Sidekiq::Extensions::DelayedModel = Sidekiq::DelayExtensions::DelayedModel
|
37
|
+
Sidekiq::Extensions::DelayedMailer = Sidekiq::DelayExtensions::DelayedMailer
|
38
|
+
|
32
39
|
Testing
|
33
40
|
-----------------
|
34
41
|
|
@@ -13,7 +13,7 @@ module Sidekiq
|
|
13
13
|
# UserMailer.delay_for(5.days).send_welcome_email(new_user)
|
14
14
|
# UserMailer.delay_until(5.days.from_now).send_welcome_email(new_user)
|
15
15
|
class DelayedMailer
|
16
|
-
include Sidekiq::
|
16
|
+
include Sidekiq::Job
|
17
17
|
|
18
18
|
def perform(yml)
|
19
19
|
(target, method_name, args) = YAML.load(yml)
|
@@ -15,7 +15,7 @@ module Sidekiq
|
|
15
15
|
# object to Redis. Your Sidekiq jobs should pass IDs, not entire instances.
|
16
16
|
# This is here for backwards compatibility with Delayed::Job only.
|
17
17
|
class DelayedModel
|
18
|
-
include Sidekiq::
|
18
|
+
include Sidekiq::Job
|
19
19
|
|
20
20
|
def perform(yml)
|
21
21
|
(target, method_name, args) = YAML.load(yml)
|
@@ -9,7 +9,7 @@ module Sidekiq
|
|
9
9
|
# Unwrap known wrappers so they show up in a human-friendly manner in the Web UI
|
10
10
|
@klass ||= self["display_class"] || begin
|
11
11
|
case klass
|
12
|
-
when /\ASidekiq::DelayExtensions::Delayed/
|
12
|
+
when /\ASidekiq::DelayExtensions::Delayed/, /\ASidekiq::Extensions::Delayed/
|
13
13
|
safe_load(args[0], klass) do |target, method, _|
|
14
14
|
"#{target}.#{method}"
|
15
15
|
end
|
@@ -22,18 +22,33 @@ module Sidekiq
|
|
22
22
|
def display_args
|
23
23
|
# Unwrap known wrappers so they show up in a human-friendly manner in the Web UI
|
24
24
|
@display_args ||= case klass
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
when /\ASidekiq::DelayExtensions::Delayed/, /\ASidekiq::Extensions::Delayed/
|
26
|
+
safe_load(args[0], args) do |_, _, arg, kwarg|
|
27
|
+
if !kwarg || kwarg.empty?
|
28
|
+
arg
|
29
|
+
else
|
30
|
+
[arg, kwarg]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
else
|
34
|
+
super
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
# per https://github.com/mperham/sidekiq/blob/v6.5.8/lib/sidekiq/api.rb#L492-L502
|
41
|
+
# vs.
|
42
|
+
# https://github.com/mperham/sidekiq/blob/v7.0.1/lib/sidekiq/api.rb#L374-L411
|
43
|
+
def safe_load(content, default)
|
44
|
+
yield(*YAML.load(content))
|
45
|
+
rescue => ex
|
46
|
+
# #1761 in dev mode, it's possible to have jobs enqueued which haven't been loaded into
|
47
|
+
# memory yet so the YAML can't be loaded.
|
48
|
+
# TODO is this still necessary? Zeitwerk reloader should handle?
|
49
|
+
Sidekiq.logger.warn "Unable to load YAML: #{ex.message}" unless Sidekiq.options[:environment] == "development"
|
50
|
+
default
|
51
|
+
end
|
37
52
|
end
|
38
53
|
end
|
39
54
|
end
|
@@ -3,6 +3,21 @@
|
|
3
3
|
require "sidekiq/testing"
|
4
4
|
|
5
5
|
module Sidekiq
|
6
|
-
|
7
|
-
|
6
|
+
module DelayedTestingExtensions
|
7
|
+
include TestingExtensions
|
8
|
+
|
9
|
+
# NOTE(BF): Extend Sidekiq::TestingExtensions
|
10
|
+
# to optionally handle unsafely loading YAML
|
11
|
+
# for delayed extensions in Sidekiq 7.x.
|
12
|
+
def jobs_for(klass, unsafe_load: false)
|
13
|
+
return super(klass) unless unsafe_load
|
14
|
+
jobs.select do |job|
|
15
|
+
marshalled = job["args"][0]
|
16
|
+
next unless marshalled.index(klass.to_s)
|
17
|
+
YAML.load(marshalled)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
Sidekiq::DelayExtensions::DelayedMailer.extend(DelayedTestingExtensions) if defined?(Sidekiq::DelayExtensions::DelayedMailer)
|
22
|
+
Sidekiq::DelayExtensions::DelayedModel.extend(DelayedTestingExtensions) if defined?(Sidekiq::DelayExtensions::DelayedModel)
|
8
23
|
end
|
@@ -6,10 +6,10 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "sidekiq-delay_extensions"
|
7
7
|
spec.version = Sidekiq::DelayExtensions::VERSION
|
8
8
|
spec.authors = ["Mike Perham", "Benjamin Fleischer"]
|
9
|
-
spec.email = ["
|
9
|
+
spec.email = ["info@contribsys.com", "github@benjaminfleischer.com"]
|
10
10
|
|
11
11
|
spec.summary = "Sidekiq Delay Extensions"
|
12
|
-
spec.description = "Extracted from Sidekiq 6.0"
|
12
|
+
spec.description = "Extracted from Sidekiq 6.0, compatible with Sidekiq 7.0"
|
13
13
|
spec.homepage = "https://github.com/gemhome/sidekiq-delay_extensions/wiki/Delayed-extensions"
|
14
14
|
spec.license = "LGPL-3.0"
|
15
15
|
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.bindir = "exe"
|
19
19
|
spec.executables = []
|
20
20
|
spec.require_paths = ["lib"]
|
21
|
-
spec.required_ruby_version = ">= 2.
|
21
|
+
spec.required_ruby_version = ">= 2.7.0"
|
22
22
|
|
23
23
|
spec.metadata = {
|
24
24
|
"homepage_uri" => "https://github.com/gemhome/sidekiq-delay_extensions/wiki/Delayed-extensions",
|
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
"source_code_uri" => "https://github.com/gemhome/sidekiq-delay_extensions"
|
29
29
|
}
|
30
30
|
|
31
|
-
spec.add_dependency "sidekiq", ">=
|
31
|
+
spec.add_dependency "sidekiq", ">= 7.0"
|
32
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-delay_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Perham
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|
@@ -17,17 +17,17 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '7.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
28
|
-
description: Extracted from Sidekiq 6.0
|
27
|
+
version: '7.0'
|
28
|
+
description: Extracted from Sidekiq 6.0, compatible with Sidekiq 7.0
|
29
29
|
email:
|
30
|
-
-
|
30
|
+
- info@contribsys.com
|
31
31
|
- github@benjaminfleischer.com
|
32
32
|
executables: []
|
33
33
|
extensions: []
|
@@ -63,14 +63,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
63
|
requirements:
|
64
64
|
- - ">="
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 2.
|
66
|
+
version: 2.7.0
|
67
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
72
|
requirements: []
|
73
|
-
rubygems_version: 3.
|
73
|
+
rubygems_version: 3.3.7
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Sidekiq Delay Extensions
|