sidekiq_publisher 3.0.0 → 5.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: 8e4cfd9a6432a0e864ad275e0ad4d9ef2e37e7e03e2d60c323d9658ae1ac40bc
4
- data.tar.gz: f0895de91a5bf0b5755835b997bd9ffa64a7b8c659516500eb21401c282b4379
3
+ metadata.gz: c19a1a0814263440df5e67a3fccbfcde9db9dd1e157f0fa338b8a39a2c72469d
4
+ data.tar.gz: 63863dfadce1cba213ec980e8f9eaf2d73a7b63a38a7bb99e608475fb57fbd00
5
5
  SHA512:
6
- metadata.gz: bba1eb7da24705acef0140082b509622c96184997a11562d6714f552ddf2fe8aa03840723e5714c677f1e5748e9c640f771245559201084627f2dd271f36d25f
7
- data.tar.gz: '069d74cacc7a2369564402944ae2dfa20b6973fcf4aee7e0d2bbb14bfb207b089aa4b15ae59abea81de2f392bdf480a2b0eadb5790c234ee7cfdf9ed6717fa64'
6
+ metadata.gz: 93d33b65bd3bf779451172474eff1b87b1552aefd8858aa3614bdb755710aded386b7909b31f1aba4d708868828dbfdda2ed676a01781fa2034772fe5cdd1afa
7
+ data.tar.gz: 5c16c2f64f50b68345a341cabb032c34f7afc4dca02c0d048880e2bb4d9dc6603edeacf86f1e7e2c83c9ed0a42d75720425ba122b2994a6f718abc1a34305ae4
data/Appraisals CHANGED
@@ -1,37 +1,37 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise "rails-6.1-sidekiq-5.2" do
3
+ appraise "rails-6.1-sidekiq-6.4" do
4
4
  gem "activejob", "~> 6.1.0"
5
5
  gem "activesupport", "~> 6.1.0"
6
- gem "sidekiq", "~> 5.2.0"
6
+ gem "sidekiq", "~> 6.4.1"
7
7
  end
8
8
 
9
- appraise "rails-6.1-sidekiq-6.0" do
9
+ appraise "rails-6.1-sidekiq-6.5" do
10
10
  gem "activejob", "~> 6.1.0"
11
11
  gem "activesupport", "~> 6.1.0"
12
- gem "sidekiq", "~> 6.0.1"
12
+ gem "sidekiq", "~> 6.5.0"
13
13
  end
14
14
 
15
- appraise "rails-6.1-sidekiq-6.1" do
16
- gem "activejob", "~> 6.1.0"
17
- gem "activesupport", "~> 6.1.0"
18
- gem "sidekiq", "~> 6.1.0"
15
+ appraise "rails-7.0-sidekiq-6.4" do
16
+ gem "activejob", "~> 7.0.0"
17
+ gem "activesupport", "~> 7.0.0"
18
+ gem "sidekiq", "~> 6.4.1"
19
19
  end
20
20
 
21
- appraise "rails-6.1-sidekiq-6.2" do
22
- gem "activejob", "~> 6.1.0"
23
- gem "activesupport", "~> 6.1.0"
24
- gem "sidekiq", "~> 6.2.0"
21
+ appraise "rails-7.0-sidekiq-6.5" do
22
+ gem "activejob", "~> 7.0.0"
23
+ gem "activesupport", "~> 7.0.0"
24
+ gem "sidekiq", "~> 6.5.0"
25
25
  end
26
26
 
27
- appraise "rails-6.1-sidekiq-6.3" do
28
- gem "activejob", "~> 6.1.0"
29
- gem "activesupport", "~> 6.1.0"
30
- gem "sidekiq", "~> 6.3.0"
27
+ appraise "rails-7.1-sidekiq-6.4" do
28
+ gem "activejob", "~> 7.1.0"
29
+ gem "activesupport", "~> 7.1.0"
30
+ gem "sidekiq", "~> 6.4.1"
31
31
  end
32
32
 
33
- appraise "rails-6.1-sidekiq-6.4" do
34
- gem "activejob", "~> 6.1.0"
35
- gem "activesupport", "~> 6.1.0"
36
- gem "sidekiq", "~> 6.4.2" # above 6.4.2 to ensure we test against breaking changes
33
+ appraise "rails-7.1-sidekiq-6.5" do
34
+ gem "activejob", "~> 7.1.0"
35
+ gem "activesupport", "~> 7.1.0"
36
+ gem "sidekiq", "~> 6.5.0"
37
37
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # sidekiq_publisher
2
2
 
3
+ ## 5.0.0
4
+ - BREAKING: Drop support for Sidekiq < 6.1.
5
+ - Add support for ActiveSupport and ActiveJob 7.1
6
+
7
+ ## 4.0.0
8
+ - BREAKING: Enqueue directly to Redis unless in a transaction ([#74](https://github.com/ezcater/sidekiq_publisher/pull/74/))
9
+
3
10
  ## 3.0.0
4
11
  - BREAKING: Drop support for Ruby `2.6` and `2.7` as they are [past end of life](https://endoflife.date/ruby)
5
12
  - BREAKING: Drop support for `ddtrace <= 1.8.0`
data/README.md CHANGED
@@ -16,6 +16,11 @@ that modifies the system of record for the application. It also allows jobs to
16
16
  be created even when Sidekiq/Redis is temporarily unavailable. The separate
17
17
  publisher process handles retries and ensure that each job is delivered to Sidekiq.
18
18
 
19
+ > :warning: Not all jobs are staged in Postgres. This is determined dynamically:
20
+ > if the job is enqueued from within an `ActiveRecord` transaction, then it is
21
+ > staged in Postgres. If not, then it bypasses Postgres and is enqueued directly
22
+ > to Redis via Sidekiq.
23
+
19
24
  ## Installation
20
25
 
21
26
  Add this line to your application's Gemfile:
@@ -4,6 +4,6 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "activejob", "~> 6.1.0"
6
6
  gem "activesupport", "~> 6.1.0"
7
- gem "sidekiq", "~> 6.4.2"
7
+ gem "sidekiq", "~> 6.4.1"
8
8
 
9
9
  gemspec path: "../"
@@ -4,6 +4,6 @@ source "https://rubygems.org"
4
4
 
5
5
  gem "activejob", "~> 6.1.0"
6
6
  gem "activesupport", "~> 6.1.0"
7
- gem "sidekiq", "~> 5.2.0"
7
+ gem "sidekiq", "~> 6.5.0"
8
8
 
9
9
  gemspec path: "../"
@@ -2,8 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activejob", "~> 6.1.0"
6
- gem "activesupport", "~> 6.1.0"
7
- gem "sidekiq", "~> 6.0.1"
5
+ gem "activejob", "~> 7.0.0"
6
+ gem "activesupport", "~> 7.0.0"
7
+ gem "sidekiq", "~> 6.4.1"
8
8
 
9
9
  gemspec path: "../"
@@ -2,8 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activejob", "~> 6.1.0"
6
- gem "activesupport", "~> 6.1.0"
7
- gem "sidekiq", "~> 6.1.0"
5
+ gem "activejob", "~> 7.0.0"
6
+ gem "activesupport", "~> 7.0.0"
7
+ gem "sidekiq", "~> 6.5.0"
8
8
 
9
9
  gemspec path: "../"
@@ -2,8 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activejob", "~> 6.1.0"
6
- gem "activesupport", "~> 6.1.0"
7
- gem "sidekiq", "~> 6.2.0"
5
+ gem "activejob", "~> 7.1.0"
6
+ gem "activesupport", "~> 7.1.0"
7
+ gem "sidekiq", "~> 6.4.1"
8
8
 
9
9
  gemspec path: "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activejob", "~> 7.1.0"
6
+ gem "activesupport", "~> 7.1.0"
7
+ gem "sidekiq", "~> 6.5.0"
8
+
9
+ gemspec path: "../"
@@ -11,19 +11,28 @@ module ActiveJob
11
11
  JOB_WRAPPER_CLASS = ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper.to_s.freeze
12
12
 
13
13
  def enqueue(job)
14
- internal_enqueue(job)
14
+ if SidekiqPublisher::DatabaseConnection.transaction_open?
15
+ create_job_record(job)
16
+ else
17
+ sidekiq_adapter.enqueue(job)
18
+ end
15
19
  end
16
20
 
17
21
  def enqueue_at(job, timestamp)
18
- internal_enqueue(job, timestamp)
22
+ if SidekiqPublisher::DatabaseConnection.transaction_open?
23
+ create_job_record(job, timestamp)
24
+ else
25
+ sidekiq_adapter.enqueue_at(job, timestamp)
26
+ end
19
27
  end
20
28
 
21
29
  private
22
30
 
23
- def internal_enqueue(job, timestamp = nil)
31
+ def create_job_record(job, timestamp = nil)
24
32
  job.provider_job_id = SidekiqPublisher::Job.generate_sidekiq_jid
25
33
  attributes = job_attributes(job)
26
34
  attributes[:run_at] = timestamp if timestamp.present?
35
+
27
36
  SidekiqPublisher::Job.create!(attributes).job_id
28
37
  end
29
38
 
@@ -36,6 +45,10 @@ module ActiveJob
36
45
  args: [job.serialize],
37
46
  }
38
47
  end
48
+
49
+ def sidekiq_adapter
50
+ @_sidekiq_adapter ||= ActiveJob::QueueAdapters::SidekiqAdapter.new
51
+ end
39
52
  end
40
53
  end
41
54
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SidekiqPublisher
4
+ module DatabaseConnection
5
+ def self.transaction_open?
6
+ ActiveRecord::Base.connection.transaction_open?
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqPublisher
4
- VERSION = "3.0.0"
4
+ VERSION = "5.0.0"
5
5
  end
@@ -10,7 +10,11 @@ module SidekiqPublisher
10
10
 
11
11
  module ClassMethods
12
12
  def client_push(item)
13
- SidekiqPublisher::Job.create_job!(item)
13
+ if SidekiqPublisher::DatabaseConnection.transaction_open?
14
+ SidekiqPublisher::Job.create_job!(item)
15
+ else
16
+ super
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -4,6 +4,7 @@ require "active_support"
4
4
  require "active_support/core_ext/numeric/time"
5
5
  require "sidekiq_publisher/version"
6
6
  require "sidekiq_publisher/compatibility"
7
+ require "sidekiq_publisher/database_connection"
7
8
  require "sidekiq_publisher/instrumenter"
8
9
  require "sidekiq_publisher/metrics_reporter"
9
10
  require "sidekiq_publisher/exception_reporter"
@@ -60,6 +60,6 @@ Gem::Specification.new do |spec|
60
60
  spec.add_development_dependency "simplecov", "< 0.18"
61
61
 
62
62
  spec.add_runtime_dependency "activerecord-postgres_pub_sub", ">= 0.4.0"
63
- spec.add_runtime_dependency "activesupport", ">= 6.1", "< 7.1"
64
- spec.add_runtime_dependency "sidekiq", ">= 5.0.4", "< 7"
63
+ spec.add_runtime_dependency "activesupport", ">= 6.1", "< 7.2"
64
+ spec.add_runtime_dependency "sidekiq", ">= 6.4.1", "< 7"
65
65
  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: 3.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ezCater, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-09 00:00:00.000000000 Z
11
+ date: 2024-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -249,7 +249,7 @@ dependencies:
249
249
  version: '6.1'
250
250
  - - "<"
251
251
  - !ruby/object:Gem::Version
252
- version: '7.1'
252
+ version: '7.2'
253
253
  type: :runtime
254
254
  prerelease: false
255
255
  version_requirements: !ruby/object:Gem::Requirement
@@ -259,14 +259,14 @@ dependencies:
259
259
  version: '6.1'
260
260
  - - "<"
261
261
  - !ruby/object:Gem::Version
262
- version: '7.1'
262
+ version: '7.2'
263
263
  - !ruby/object:Gem::Dependency
264
264
  name: sidekiq
265
265
  requirement: !ruby/object:Gem::Requirement
266
266
  requirements:
267
267
  - - ">="
268
268
  - !ruby/object:Gem::Version
269
- version: 5.0.4
269
+ version: 6.4.1
270
270
  - - "<"
271
271
  - !ruby/object:Gem::Version
272
272
  version: '7'
@@ -276,7 +276,7 @@ dependencies:
276
276
  requirements:
277
277
  - - ">="
278
278
  - !ruby/object:Gem::Version
279
- version: 5.0.4
279
+ version: 6.4.1
280
280
  - - "<"
281
281
  - !ruby/object:Gem::Version
282
282
  version: '7'
@@ -297,18 +297,19 @@ files:
297
297
  - LICENSE.txt
298
298
  - README.md
299
299
  - app/models/sidekiq_publisher/job.rb
300
- - gemfiles/rails_6.1_sidekiq_5.2.gemfile
301
- - gemfiles/rails_6.1_sidekiq_6.0.gemfile
302
- - gemfiles/rails_6.1_sidekiq_6.1.gemfile
303
- - gemfiles/rails_6.1_sidekiq_6.2.gemfile
304
- - gemfiles/rails_6.1_sidekiq_6.3.gemfile
305
300
  - gemfiles/rails_6.1_sidekiq_6.4.gemfile
301
+ - gemfiles/rails_6.1_sidekiq_6.5.gemfile
302
+ - gemfiles/rails_7.0_sidekiq_6.4.gemfile
303
+ - gemfiles/rails_7.0_sidekiq_6.5.gemfile
304
+ - gemfiles/rails_7.1_sidekiq_6.4.gemfile
305
+ - gemfiles/rails_7.1_sidekiq_6.5.gemfile
306
306
  - lib/active_job/queue_adapters/sidekiq_publisher_adapter.rb
307
307
  - lib/generators/sidekiq_publisher/install_generator.rb
308
308
  - lib/generators/sidekiq_publisher/templates/create_sidekiq_publisher_jobs.rb
309
309
  - lib/sidekiq_publisher.rb
310
310
  - lib/sidekiq_publisher/client.rb
311
311
  - lib/sidekiq_publisher/compatibility.rb
312
+ - lib/sidekiq_publisher/database_connection.rb
312
313
  - lib/sidekiq_publisher/datadog_apm.rb
313
314
  - lib/sidekiq_publisher/engine.rb
314
315
  - lib/sidekiq_publisher/exception_reporter.rb
@@ -344,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
345
  - !ruby/object:Gem::Version
345
346
  version: '0'
346
347
  requirements: []
347
- rubygems_version: 3.1.6
348
+ rubygems_version: 3.4.16
348
349
  signing_key:
349
350
  specification_version: 4
350
351
  summary: Publisher for enqueuing jobs to Sidekiq
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activejob", "~> 6.1.0"
6
- gem "activesupport", "~> 6.1.0"
7
- gem "sidekiq", "~> 6.3.0"
8
-
9
- gemspec path: "../"