sidekiq_publisher 1.7.0.rc1 → 2.0.0.rc0

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: 7b46548489774867e03fcbd1c4359909cc12d4baf7a92091d06bf45bba3d3120
4
- data.tar.gz: c8f0fcd1ec8127f62e880a6282baeeb8b851583d06db25d0ac2e3d85287e1e32
3
+ metadata.gz: 1bef2eda10ec3e9fc09d95fe0af551b408331b8d3a42ff35d6c0f1012ea744e2
4
+ data.tar.gz: 317a3f1d450d71e0504fc351b33792002f83a0c9d36e2e2f6cf1c985d546c62b
5
5
  SHA512:
6
- metadata.gz: 36d2cfa5d35ef29acde6294318d34fbbccf2960d2bd5304ec35bdf0b1c76d4abf6f4130daf0cd37046f101242e236c4855e2a777a7ca6cddb62ca8ae0fad07ea
7
- data.tar.gz: 1ac0af71177ed8b6188f0c845e2bb832c73f911326cb8b078f64ce506ce80bc5d6078b0a5a6c9ae0c29839a996f3d92f43f417e2efd38320b615b57c73ac8dbf
6
+ metadata.gz: c6dc3e3765c0b2e819087aa249add2fb2baf7b625394def4702e7340d210aeb6e2f51be9d529d19be4731742ec66f7a940867f8f28b1dd09112abafc7a620929
7
+ data.tar.gz: '09598e9b91cd23c47f8aa583155acfb16d54b01a534ef727463f77692999776f29db0df7dfa826b961688f9e20ed6beda568e5c6bd8abb76148717411604f2ce'
data/Appraisals CHANGED
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise "rails-5.1" do
4
- gem "activejob", "~> 5.1.6"
5
- gem "activesupport", "~> 5.1.6"
6
- end
7
-
8
3
  appraise "rails-5.2-sidekiq-5.0" do
9
4
  gem "activejob", "~> 5.2.0"
10
5
  gem "activesupport", "~> 5.2.0"
@@ -52,3 +47,21 @@ appraise "rails-6.0-sidekiq-6.1" do
52
47
  gem "activesupport", "~> 6.0.0"
53
48
  gem "sidekiq", "~> 6.1.0"
54
49
  end
50
+
51
+ appraise "rails-6.1-sidekiq-5.2" do
52
+ gem "activejob", "~> 6.1.0"
53
+ gem "activesupport", "~> 6.1.0"
54
+ gem "sidekiq", "~> 5.2.0"
55
+ end
56
+
57
+ appraise "rails-6.1-sidekiq-6.0" do
58
+ gem "activejob", "~> 6.1.0"
59
+ gem "activesupport", "~> 6.1.0"
60
+ gem "sidekiq", "~> 6.0.1"
61
+ end
62
+
63
+ appraise "rails-6.1-sidekiq-6.1" do
64
+ gem "activejob", "~> 6.1.0"
65
+ gem "activesupport", "~> 6.1.0"
66
+ gem "sidekiq", "~> 6.1.0"
67
+ end
data/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # sidekiq_publisher
2
2
 
3
- ## v1.7.0 (unreleased)
3
+ ## v2.0.0 (unreleased)
4
+ - Transition from defining a Railtie to becoming a Rails Engine
5
+ [(#44)](https://github.com/ezcater/sidekiq_publisher/pull/44). This change was
6
+ made to better support Ruby 3.0 and Rails 6.1. The change is *not* expected to
7
+ be breaking but it does represent a major change in the gem's implementation
8
+ change and that is the reason for the major version bump.
9
+ - Require Ruby 2.6 or later.
10
+
11
+ ## v1.8.0
12
+ - Extend support to Rails 6.1.
13
+
14
+ ## v1.7.1
15
+ - Gracefully handle database connection errors in ReportUnpublishedCount by attempting to reconnect.
16
+
17
+ ## v1.7.0
4
18
  - Add instrumentation using `ActiveSupport::Notifications`.
5
19
  - Reimplement `metrics_reporter` and `exception_reporter` support using
6
20
  `ActiveSupport::Subscriber`.
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ezcater-production.jfrog.io/ruby:f08726283c
1
+ FROM ezcater-production.jfrog.io/ruby:90790156c4
2
2
  RUN mkdir /usr/src/gem
3
3
  WORKDIR /usr/src/gem
4
4
  ADD . /usr/src/gem
data/README.md CHANGED
@@ -136,6 +136,21 @@ class MyJob < ApplicationJob
136
136
  end
137
137
  ```
138
138
 
139
+ #### ActiveJob Exception Reporting
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
144
+ `ActiveJob::QueueAdapters::SidekiqPublisherAdapter` as a compatible adapter for this to work properly.
145
+
146
+ Alternatively, you can manually report the exception:
147
+
148
+ ```ruby
149
+ retry_on SomeError, attempts: 10 do |_job, exception|
150
+ Raven.capture_exception(exception, extra: { custom: :foo }) # Reporting using the Sentry gem
151
+ end
152
+ ```
153
+
139
154
  ### SidekiqPublisher::Worker
140
155
 
141
156
  Sidekiq workers are usually defined by including `Sidekiq::Worker` in a class.
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_record"
4
-
5
3
  module SidekiqPublisher
6
4
  class Job < ActiveRecord::Base
7
5
  self.table_name = "sidekiq_publisher_jobs"
data/docker-compose.yml CHANGED
@@ -7,6 +7,7 @@ x-environment: &default-environment
7
7
  BUNDLE_IGNORE_CONFIG: 1
8
8
  BUNDLE_DISABLE_SHARED_GEMS: "true"
9
9
  PGUSER: postgres
10
+ PGPASSWORD: postgres
10
11
  PGHOST: sidekiq-publisher-postgres
11
12
  PGPORT: 5432
12
13
  PGDATABASE: sidekiq_publisher_test
@@ -28,9 +29,10 @@ services:
28
29
  image: redis:5.0.9-alpine
29
30
  sidekiq-publisher-postgres:
30
31
  container_name: sidekiq-publisher-postgres_1
31
- image: postgres:11.6
32
+ image: postgres:12.6
32
33
  environment:
33
34
  POSTGRES_USER: postgres
35
+ POSTGRES_PASSWORD: postgres
34
36
  POSTGRES_DB: sidekiq_publisher_test
35
37
  sidekiq-publisher-console:
36
38
  <<: *default-service
@@ -2,7 +2,8 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activejob", "~> 5.1.6"
6
- gem "activesupport", "~> 5.1.6"
5
+ gem "activejob", "~> 6.1.0"
6
+ gem "activesupport", "~> 6.1.0"
7
+ gem "sidekiq", "~> 5.2.0"
7
8
 
8
9
  gemspec path: "../"
@@ -0,0 +1,9 @@
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.0.1"
8
+
9
+ gemspec path: "../"
@@ -0,0 +1,9 @@
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.1.0"
8
+
9
+ gemspec path: "../"
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_job/queue_adapters/sidekiq_adapter"
4
+ require "active_support/core_ext/object/blank"
4
5
 
5
6
  module ActiveJob
6
7
  module QueueAdapters
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support"
4
+ require "active_support/core_ext/numeric/time"
4
5
  require "sidekiq_publisher/version"
5
6
  require "sidekiq_publisher/instrumenter"
6
7
  require "sidekiq_publisher/metrics_reporter"
7
8
  require "sidekiq_publisher/exception_reporter"
8
9
  require "sidekiq_publisher/report_unpublished_count"
9
- require "sidekiq_publisher/job"
10
10
  require "sidekiq_publisher/worker"
11
11
  require "sidekiq_publisher/publisher"
12
12
  require "sidekiq_publisher/runner"
13
- require "sidekiq_publisher/railtie" if defined?(Rails)
13
+ require "sidekiq_publisher/engine" if defined?(Rails)
14
14
 
15
15
  module SidekiqPublisher
16
16
  DEFAULT_BATCH_SIZE = 100
@@ -1,10 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqPublisher
4
- class Railtie < Rails::Railtie
5
- rake_tasks do
6
- load "sidekiq_publisher/tasks.rake"
7
- end
4
+ class Engine < Rails::Engine
5
+ isolate_namespace SidekiqPublisher
8
6
 
9
7
  initializer "sidekiq_publisher.configure" do
10
8
  SidekiqPublisher.logger = Rails.logger
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_support/subscriber"
4
+ require "active_support/core_ext/object/try"
4
5
 
5
6
  module SidekiqPublisher
6
7
  module MetricsReporter
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "sidekiq_publisher/client"
4
- require "active_support/core_ext/object/try"
4
+ require "active_support/core_ext/object/blank"
5
5
 
6
6
  module SidekiqPublisher
7
7
  class Publisher
@@ -1,10 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_record"
4
+ require "pg"
5
+
3
6
  module SidekiqPublisher
4
7
  module ReportUnpublishedCount
5
8
  def self.call(instrumenter: Instrumenter.new)
6
9
  instrumenter.instrument("unpublished.reporter",
7
10
  unpublished_count: SidekiqPublisher::Job.unpublished.count)
11
+ rescue ActiveRecord::StatementInvalid, PG::UnableToSend, PG::ConnectionBad => e
12
+ ActiveRecord::Base.clear_active_connections! if db_connection_error?(e)
13
+ raise
14
+ end
15
+
16
+ def self.db_connection_error?(error)
17
+ cause = error.is_a?(ActiveRecord::StatementInvalid) ? error.cause : error
18
+ cause.is_a?(PG::UnableToSend) || cause.is_a?(PG::ConnectionBad)
8
19
  end
20
+ private_class_method :db_connection_error?
9
21
  end
10
22
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqPublisher
4
- VERSION = "1.7.0.rc1"
4
+ VERSION = "2.0.0.rc0"
5
5
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  namespace :sidekiq_publisher do
4
+ desc "Start the Sidekiq Publisher runner"
4
5
  task publish: [:environment] do
5
6
  Signal.trap("INT") { exit(0) }
6
7
  Signal.trap("TERM") { exit(0) }
@@ -41,6 +41,8 @@ Gem::Specification.new do |spec|
41
41
  spec.executables = []
42
42
  spec.require_paths = ["lib"]
43
43
 
44
+ spec.required_ruby_version = ">= 2.6"
45
+
44
46
  spec.add_development_dependency "activejob"
45
47
  spec.add_development_dependency "appraisal"
46
48
  spec.add_development_dependency "bundler", "~> 1.12"
@@ -58,6 +60,6 @@ Gem::Specification.new do |spec|
58
60
  spec.add_development_dependency "simplecov", "< 0.18"
59
61
 
60
62
  spec.add_runtime_dependency "activerecord-postgres_pub_sub", ">= 0.4.0"
61
- spec.add_runtime_dependency "activesupport", ">= 5.1", "< 6.1"
63
+ spec.add_runtime_dependency "activesupport", ">= 5.1", "< 6.2"
62
64
  spec.add_runtime_dependency "sidekiq", ">= 5.0.4", "< 7.0"
63
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: 1.7.0.rc1
4
+ version: 2.0.0.rc0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ezCater, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-07 00:00:00.000000000 Z
11
+ date: 2021-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -243,7 +243,7 @@ dependencies:
243
243
  version: '5.1'
244
244
  - - "<"
245
245
  - !ruby/object:Gem::Version
246
- version: '6.1'
246
+ version: '6.2'
247
247
  type: :runtime
248
248
  prerelease: false
249
249
  version_requirements: !ruby/object:Gem::Requirement
@@ -253,7 +253,7 @@ dependencies:
253
253
  version: '5.1'
254
254
  - - "<"
255
255
  - !ruby/object:Gem::Version
256
- version: '6.1'
256
+ version: '6.2'
257
257
  - !ruby/object:Gem::Dependency
258
258
  name: sidekiq
259
259
  requirement: !ruby/object:Gem::Requirement
@@ -289,8 +289,8 @@ files:
289
289
  - Gemfile
290
290
  - LICENSE.txt
291
291
  - README.md
292
+ - app/models/sidekiq_publisher/job.rb
292
293
  - docker-compose.yml
293
- - gemfiles/rails_5.1.gemfile
294
294
  - gemfiles/rails_5.2.gemfile
295
295
  - gemfiles/rails_5.2_sidekiq_5.0.gemfile
296
296
  - gemfiles/rails_5.2_sidekiq_5.1.gemfile
@@ -300,24 +300,26 @@ files:
300
300
  - gemfiles/rails_6.0_sidekiq_5.2.gemfile
301
301
  - gemfiles/rails_6.0_sidekiq_6.0.gemfile
302
302
  - gemfiles/rails_6.0_sidekiq_6.1.gemfile
303
+ - gemfiles/rails_6.1_sidekiq_5.2.gemfile
304
+ - gemfiles/rails_6.1_sidekiq_6.0.gemfile
305
+ - gemfiles/rails_6.1_sidekiq_6.1.gemfile
303
306
  - lib/active_job/queue_adapters/sidekiq_publisher_adapter.rb
304
307
  - lib/generators/sidekiq_publisher/install_generator.rb
305
308
  - lib/generators/sidekiq_publisher/templates/create_sidekiq_publisher_jobs.rb
306
309
  - lib/sidekiq_publisher.rb
307
310
  - lib/sidekiq_publisher/client.rb
308
311
  - lib/sidekiq_publisher/datadog_apm.rb
312
+ - lib/sidekiq_publisher/engine.rb
309
313
  - lib/sidekiq_publisher/exception_reporter.rb
310
314
  - lib/sidekiq_publisher/instrumenter.rb
311
- - lib/sidekiq_publisher/job.rb
312
315
  - lib/sidekiq_publisher/metrics_reporter.rb
313
316
  - lib/sidekiq_publisher/publisher.rb
314
- - lib/sidekiq_publisher/railtie.rb
315
317
  - lib/sidekiq_publisher/report_unpublished_count.rb
316
318
  - lib/sidekiq_publisher/runner.rb
317
- - lib/sidekiq_publisher/tasks.rake
318
319
  - lib/sidekiq_publisher/testing.rb
319
320
  - lib/sidekiq_publisher/version.rb
320
321
  - lib/sidekiq_publisher/worker.rb
322
+ - lib/tasks/sidekiq_publisher.rake
321
323
  - log/.gitkeep
322
324
  - sidekiq_publisher.gemspec
323
325
  homepage: https://github.com/ezcater/sidekiq_publisher
@@ -333,14 +335,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
333
335
  requirements:
334
336
  - - ">="
335
337
  - !ruby/object:Gem::Version
336
- version: '0'
338
+ version: '2.6'
337
339
  required_rubygems_version: !ruby/object:Gem::Requirement
338
340
  requirements:
339
341
  - - ">"
340
342
  - !ruby/object:Gem::Version
341
343
  version: 1.3.1
342
344
  requirements: []
343
- rubygems_version: 3.1.4
345
+ rubyforge_project:
346
+ rubygems_version: 2.7.6.2
344
347
  signing_key:
345
348
  specification_version: 4
346
349
  summary: Publisher for enqueuing jobs to Sidekiq