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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: beb5bfc9e96d466f3243e2a46d1826f67463b973fc9d6ce72687abe085cb61ab
4
- data.tar.gz: 17d9241ad6cde74793d0e5c860b962044a8c9b592a8059566c4391a55f068b49
3
+ metadata.gz: 95dda38ae3c61ad156898807a993f2e4ed94a1e9fa84e0acefc55e9eda8c563f
4
+ data.tar.gz: c01d2df0317cb993a90ea42edf54c8cd8555a47abc6e9fc5aeca30cd3c609970
5
5
  SHA512:
6
- metadata.gz: f8ac369b7701a8c979c729a512287d0956b1f952c87f48660d2f1262c14ab992cea51970626fc01eb737263e7c67b9dc1ad220542695964a74ad591ec2970fd8
7
- data.tar.gz: a1cd9feaaae12197787b9b707689c61b6631e559f61cec18b0d35eac56165046100dba4822f5d0dd0c8ceae56e648113e3ee4bdd97a602a2b0df1af2072fcc01
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 Changes](https://github.com/gemhome/sidekiq-delay_extensions/blob/main/Changes.md)
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", ">= 6.4.1"
5
+ gem "sidekiq", "~> 7.0"
6
6
  gem "rake"
7
- gem "redis-namespace"
8
- gem "rails", ">= 6.0.2"
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
- # mail dependencies
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 "minitest"
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/gehome/sidekiq-delay_extensions/workflows/CI/badge.svg)
5
+ ![Build](https://github.com/gemhome/sidekiq-delay_extensions/workflows/CI/badge.svg)
6
6
 
7
- The [Sidekiq delay extensions are deprecated in 6.x and will be removed from 7.x](https://github.com/mperham/sidekiq/issues/5076).
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 and will match
10
- Sidekiq 6.x version numbers.
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
- When Sidekiq reaches 7.0, this gem will begin being maintained on its own. Maintainers wanted.
12
+ This gem is maintained independent of Sidekiq. Maintainers wanted.
13
13
 
14
14
  Requirements
15
15
  -----------------
16
16
 
17
- - See https://github.com/mperham/sidekiq/tree/v6.4.1
18
- - Redis: 4.0+
19
- - Ruby: MRI 2.5+ or JRuby 9.2+.
20
- - Sidekiq 6.0 supports Rails 5.0+ but does not require it.
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
- gem install sidekiq
26
- gem install sidekiq-delay_extensions
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::Worker
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::Worker
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
- when /\ASidekiq::DelayExtensions::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
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
@@ -13,7 +13,7 @@ module Sidekiq
13
13
  # Wikipedia.delay.download_changes_for(Date.today)
14
14
  #
15
15
  class DelayedClass
16
- include Sidekiq::Worker
16
+ include Sidekiq::Job
17
17
 
18
18
  def perform(yml)
19
19
  (target, method_name, args) = YAML.load(yml)
@@ -10,7 +10,7 @@ module Sidekiq
10
10
  def initialize(performable, target, options = {})
11
11
  @performable = performable
12
12
  @target = target
13
- @opts = options
13
+ @opts = options.transform_keys(&:to_s)
14
14
  end
15
15
 
16
16
  def method_missing(name, *args)
@@ -3,6 +3,21 @@
3
3
  require "sidekiq/testing"
4
4
 
5
5
  module Sidekiq
6
- Sidekiq::DelayExtensions::DelayedMailer.extend(TestingExtensions) if defined?(Sidekiq::DelayExtensions::DelayedMailer)
7
- Sidekiq::DelayExtensions::DelayedModel.extend(TestingExtensions) if defined?(Sidekiq::DelayExtensions::DelayedModel)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module DelayExtensions
5
- VERSION = "6.4.1"
5
+ VERSION = "7.0.0"
6
6
  end
7
7
  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 = ["mperham@gmail.com", "github@benjaminfleischer.com"]
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.5.0"
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", ">= 6.4.1"
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: 6.4.1
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: 2022-02-08 00:00:00.000000000 Z
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: 6.4.1
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: 6.4.1
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
- - mperham@gmail.com
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.5.0
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.1.4
73
+ rubygems_version: 3.3.7
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Sidekiq Delay Extensions