sidekiq_publisher 2.0.0.rc0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +36 -0
- data/CHANGELOG.md +14 -2
- data/README.md +6 -5
- data/app/models/sidekiq_publisher/job.rb +9 -1
- data/gemfiles/rails_5.2_sidekiq_6.2.gemfile +9 -0
- data/gemfiles/rails_6.0_sidekiq_6.2.gemfile +9 -0
- data/gemfiles/rails_6.1_sidekiq_6.2.gemfile +9 -0
- data/lib/sidekiq_publisher/compatibility.rb +22 -0
- data/lib/sidekiq_publisher/version.rb +1 -1
- data/lib/sidekiq_publisher/worker.rb +1 -1
- data/lib/sidekiq_publisher.rb +1 -0
- data/sidekiq_publisher.gemspec +1 -1
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ca992a4d903fe216977ebf332301a80d363f3e4f9b16e096c9709cd160e628c
|
4
|
+
data.tar.gz: 1634e4fc0793db4de6329a208abf16b215ec43854bf17ee9b96f23914e8dc35c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5a40a98bfc841382ed03e468028728a832dbe0867bdfe90209b6e6aca458e7c2ce89c95e8a075fc43ec017438b1e2661f863d391bc337fba700a944fda6cfe8
|
7
|
+
data.tar.gz: 1114316164932338779521dde2fa7a36cf18cfcf810fc7642b7af2b55f6777e8700eccd3489bfe0d4b66265accda5894b6a7efdfda004fbbc6e94ddebcf76d40
|
data/Appraisals
CHANGED
@@ -30,6 +30,18 @@ appraise "rails-5.2-sidekiq-6.1" do
|
|
30
30
|
gem "sidekiq", "~> 6.1.0"
|
31
31
|
end
|
32
32
|
|
33
|
+
appraise "rails-5.2-sidekiq-6.2" do
|
34
|
+
gem "activejob", "~> 5.2.0"
|
35
|
+
gem "activesupport", "~> 5.2.0"
|
36
|
+
gem "sidekiq", "~> 6.2.0"
|
37
|
+
end
|
38
|
+
|
39
|
+
appraise "rails-5.2-sidekiq-6.3" do
|
40
|
+
gem "activejob", "~> 5.2.0"
|
41
|
+
gem "activesupport", "~> 5.2.0"
|
42
|
+
gem "sidekiq", "~> 6.3.0"
|
43
|
+
end
|
44
|
+
|
33
45
|
appraise "rails-6.0-sidekiq-5.2" do
|
34
46
|
gem "activejob", "~> 6.0.0"
|
35
47
|
gem "activesupport", "~> 6.0.0"
|
@@ -48,6 +60,18 @@ appraise "rails-6.0-sidekiq-6.1" do
|
|
48
60
|
gem "sidekiq", "~> 6.1.0"
|
49
61
|
end
|
50
62
|
|
63
|
+
appraise "rails-6.0-sidekiq-6.2" do
|
64
|
+
gem "activejob", "~> 6.0.0"
|
65
|
+
gem "activesupport", "~> 6.0.0"
|
66
|
+
gem "sidekiq", "~> 6.2.0"
|
67
|
+
end
|
68
|
+
|
69
|
+
appraise "rails-6.0-sidekiq-6.3" do
|
70
|
+
gem "activejob", "~> 6.0.0"
|
71
|
+
gem "activesupport", "~> 6.0.0"
|
72
|
+
gem "sidekiq", "~> 6.3.0"
|
73
|
+
end
|
74
|
+
|
51
75
|
appraise "rails-6.1-sidekiq-5.2" do
|
52
76
|
gem "activejob", "~> 6.1.0"
|
53
77
|
gem "activesupport", "~> 6.1.0"
|
@@ -65,3 +89,15 @@ appraise "rails-6.1-sidekiq-6.1" do
|
|
65
89
|
gem "activesupport", "~> 6.1.0"
|
66
90
|
gem "sidekiq", "~> 6.1.0"
|
67
91
|
end
|
92
|
+
|
93
|
+
appraise "rails-6.1-sidekiq-6.2" do
|
94
|
+
gem "activejob", "~> 6.1.0"
|
95
|
+
gem "activesupport", "~> 6.1.0"
|
96
|
+
gem "sidekiq", "~> 6.2.0"
|
97
|
+
end
|
98
|
+
|
99
|
+
appraise "rails-6.1-sidekiq-6.3" do
|
100
|
+
gem "activejob", "~> 6.1.0"
|
101
|
+
gem "activesupport", "~> 6.1.0"
|
102
|
+
gem "sidekiq", "~> 6.3.0"
|
103
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,23 @@
|
|
1
1
|
# sidekiq_publisher
|
2
2
|
|
3
|
-
##
|
3
|
+
## 2.1.1
|
4
|
+
- Opt-in to [Rubygems MFA](https://guides.rubygems.org/mfa-requirement-opt-in/)
|
5
|
+
for privileged operations
|
6
|
+
|
7
|
+
## 2.1.0
|
8
|
+
- Add support for sidekiq `7.0.0` by using `Sidekiq::Job` instead of
|
9
|
+
`Sidekiq::Worker` in sidekiq `>= 6.3.0` to handle name changes outlined in
|
10
|
+
mperham/sidekiq#4971 and first introduced in 6.2.2.
|
11
|
+
|
12
|
+
## 2.0.1
|
13
|
+
- Changing the `Job#args` validator to be a manual check instead of using the `exclusions` validator. This is to fix an issue introduced with rails 6.1 and the condition of `in: [nil]`. More details [here](https://github.com/rails/rails/issues/41051).
|
14
|
+
|
15
|
+
## v2.0.0
|
4
16
|
- Transition from defining a Railtie to becoming a Rails Engine
|
5
17
|
[(#44)](https://github.com/ezcater/sidekiq_publisher/pull/44). This change was
|
6
18
|
made to better support Ruby 3.0 and Rails 6.1. The change is *not* expected to
|
7
19
|
be breaking but it does represent a major change in the gem's implementation
|
8
|
-
|
20
|
+
and that is the reason for the major version bump.
|
9
21
|
- Require Ruby 2.6 or later.
|
10
22
|
|
11
23
|
## v1.8.0
|
data/README.md
CHANGED
@@ -138,22 +138,23 @@ end
|
|
138
138
|
|
139
139
|
#### ActiveJob Exception Reporting
|
140
140
|
|
141
|
-
Many exception monitoring service (e.g. Sentry, Airbrake, Honeybadger, etc) already provide basic integration support for `Sidekiq`.
|
142
|
-
These integration should also work with `SidekiqPublisher`.
|
143
|
-
However, you may need to explicitly include
|
141
|
+
Many exception monitoring service (e.g. Sentry, Airbrake, Honeybadger, etc) already provide basic integration support for `Sidekiq`.
|
142
|
+
These integration should also work with `SidekiqPublisher`.
|
143
|
+
However, you may need to explicitly include
|
144
144
|
`ActiveJob::QueueAdapters::SidekiqPublisherAdapter` as a compatible adapter for this to work properly.
|
145
145
|
|
146
146
|
Alternatively, you can manually report the exception:
|
147
147
|
|
148
148
|
```ruby
|
149
149
|
retry_on SomeError, attempts: 10 do |_job, exception|
|
150
|
-
Raven.capture_exception(exception, extra: { custom: :foo }) # Reporting using the Sentry gem
|
150
|
+
Raven.capture_exception(exception, extra: { custom: :foo }) # Reporting using the Sentry gem
|
151
151
|
end
|
152
152
|
```
|
153
153
|
|
154
154
|
### SidekiqPublisher::Worker
|
155
155
|
|
156
|
-
Sidekiq workers are usually defined by including `Sidekiq::
|
156
|
+
Sidekiq workers are usually defined by including `Sidekiq::Job` or
|
157
|
+
`Sidekiq::Worker` in a class.
|
157
158
|
|
158
159
|
To use the `SidekiqPublisher`, this can be replaced by including
|
159
160
|
`SidekiqPublisher::Worker`. The usual `perform_async`, etc methods will be
|
@@ -10,7 +10,11 @@ module SidekiqPublisher
|
|
10
10
|
before_save :ensure_string_job_class
|
11
11
|
|
12
12
|
validates :job_class, presence: true
|
13
|
-
|
13
|
+
# This exclusion rule currently has a bug in rails 6.1. For now, we will use a manual implementation
|
14
|
+
# Github Issue: https://github.com/rails/rails/issues/41051
|
15
|
+
# Possible PR: https://github.com/rails/rails/pull/41412
|
16
|
+
# validates :args, exclusion: { in: [nil] }
|
17
|
+
validate :args_not_nil
|
14
18
|
|
15
19
|
scope :unpublished, -> { where(published_at: nil) }
|
16
20
|
scope :published, -> { where.not(published_at: nil) }
|
@@ -54,6 +58,10 @@ module SidekiqPublisher
|
|
54
58
|
|
55
59
|
private
|
56
60
|
|
61
|
+
def args_not_nil
|
62
|
+
errors.add(:args, "is reserved") if args.nil?
|
63
|
+
end
|
64
|
+
|
57
65
|
def ensure_job_id
|
58
66
|
self.job_id ||= self.class.generate_sidekiq_jid
|
59
67
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SidekiqPublisher
|
4
|
+
module Compatibility
|
5
|
+
class << self
|
6
|
+
# Sidekiq::Worker will be renamed to Sidekiq::Job in sidekiq 7.0.0 and a
|
7
|
+
# deprecation warning will be printed in sidekiq 6.4.0, per
|
8
|
+
# mperham/sidekiq#4971. Sidekiq 6.2.2 (mperham/sidekiq@8e36432) introduces
|
9
|
+
# an alias and 6.3.0 includes it when the gem is loaded. This alias is
|
10
|
+
# used here to ensure future compatibility.
|
11
|
+
def sidekiq_job_class
|
12
|
+
@_sidekiq_job_class ||= Gem::Dependency.new("sidekiq", ">= 6.3.0").then do |dependency|
|
13
|
+
if dependency.match?(Gem.loaded_specs["sidekiq"])
|
14
|
+
Sidekiq::Job
|
15
|
+
else
|
16
|
+
Sidekiq::Worker
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module SidekiqPublisher
|
4
4
|
module Worker
|
5
5
|
def self.included(base)
|
6
|
-
base.include(
|
6
|
+
base.include(SidekiqPublisher::Compatibility.sidekiq_job_class)
|
7
7
|
base.singleton_class.public_send(:alias_method, :sidekiq_client_push, :client_push)
|
8
8
|
base.extend(ClassMethods)
|
9
9
|
end
|
data/lib/sidekiq_publisher.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "active_support"
|
4
4
|
require "active_support/core_ext/numeric/time"
|
5
5
|
require "sidekiq_publisher/version"
|
6
|
+
require "sidekiq_publisher/compatibility"
|
6
7
|
require "sidekiq_publisher/instrumenter"
|
7
8
|
require "sidekiq_publisher/metrics_reporter"
|
8
9
|
require "sidekiq_publisher/exception_reporter"
|
data/sidekiq_publisher.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
# Set "allowed_push_post" to control where this gem can be published.
|
18
18
|
if spec.respond_to?(:metadata)
|
19
19
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
20
|
-
|
20
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
21
21
|
else
|
22
22
|
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq_publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ezCater, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -297,17 +297,21 @@ files:
|
|
297
297
|
- gemfiles/rails_5.2_sidekiq_5.2.gemfile
|
298
298
|
- gemfiles/rails_5.2_sidekiq_6.0.gemfile
|
299
299
|
- gemfiles/rails_5.2_sidekiq_6.1.gemfile
|
300
|
+
- gemfiles/rails_5.2_sidekiq_6.2.gemfile
|
300
301
|
- gemfiles/rails_6.0_sidekiq_5.2.gemfile
|
301
302
|
- gemfiles/rails_6.0_sidekiq_6.0.gemfile
|
302
303
|
- gemfiles/rails_6.0_sidekiq_6.1.gemfile
|
304
|
+
- gemfiles/rails_6.0_sidekiq_6.2.gemfile
|
303
305
|
- gemfiles/rails_6.1_sidekiq_5.2.gemfile
|
304
306
|
- gemfiles/rails_6.1_sidekiq_6.0.gemfile
|
305
307
|
- gemfiles/rails_6.1_sidekiq_6.1.gemfile
|
308
|
+
- gemfiles/rails_6.1_sidekiq_6.2.gemfile
|
306
309
|
- lib/active_job/queue_adapters/sidekiq_publisher_adapter.rb
|
307
310
|
- lib/generators/sidekiq_publisher/install_generator.rb
|
308
311
|
- lib/generators/sidekiq_publisher/templates/create_sidekiq_publisher_jobs.rb
|
309
312
|
- lib/sidekiq_publisher.rb
|
310
313
|
- lib/sidekiq_publisher/client.rb
|
314
|
+
- lib/sidekiq_publisher/compatibility.rb
|
311
315
|
- lib/sidekiq_publisher/datadog_apm.rb
|
312
316
|
- lib/sidekiq_publisher/engine.rb
|
313
317
|
- lib/sidekiq_publisher/exception_reporter.rb
|
@@ -327,6 +331,7 @@ licenses:
|
|
327
331
|
- MIT
|
328
332
|
metadata:
|
329
333
|
allowed_push_host: https://rubygems.org
|
334
|
+
rubygems_mfa_required: 'true'
|
330
335
|
post_install_message:
|
331
336
|
rdoc_options: []
|
332
337
|
require_paths:
|
@@ -338,12 +343,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
338
343
|
version: '2.6'
|
339
344
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
340
345
|
requirements:
|
341
|
-
- - "
|
346
|
+
- - ">="
|
342
347
|
- !ruby/object:Gem::Version
|
343
|
-
version:
|
348
|
+
version: '0'
|
344
349
|
requirements: []
|
345
|
-
|
346
|
-
rubygems_version: 2.7.6.2
|
350
|
+
rubygems_version: 3.1.4
|
347
351
|
signing_key:
|
348
352
|
specification_version: 4
|
349
353
|
summary: Publisher for enqueuing jobs to Sidekiq
|