sidekiq_publisher 1.7.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +18 -5
- data/CHANGELOG.md +14 -0
- data/Dockerfile +1 -1
- data/README.md +15 -0
- data/{lib → app/models}/sidekiq_publisher/job.rb +0 -2
- data/docker-compose.yml +3 -1
- data/gemfiles/{rails_5.1.gemfile → rails_6.1_sidekiq_5.2.gemfile} +3 -2
- data/gemfiles/rails_6.1_sidekiq_6.0.gemfile +9 -0
- data/gemfiles/rails_6.1_sidekiq_6.1.gemfile +9 -0
- data/lib/active_job/queue_adapters/sidekiq_publisher_adapter.rb +1 -0
- data/lib/sidekiq_publisher.rb +2 -2
- data/lib/sidekiq_publisher/{railtie.rb → engine.rb} +2 -4
- data/lib/sidekiq_publisher/metrics_reporter.rb +1 -0
- data/lib/sidekiq_publisher/publisher.rb +1 -1
- data/lib/sidekiq_publisher/report_unpublished_count.rb +12 -0
- data/lib/sidekiq_publisher/version.rb +1 -1
- data/lib/{sidekiq_publisher/tasks.rake → tasks/sidekiq_publisher.rake} +1 -0
- data/sidekiq_publisher.gemspec +3 -1
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbd6a68303b5c42905e58ee64d231331265fbbbdb11316470e5fa8e83966de7e
|
4
|
+
data.tar.gz: 6773cbea5ae5010a4d9771d043b5210f65fe21d064097dfbbf76d0ed936ad3ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af0eced6cc6b0343ae91ad8d8c80b6e02fd004aa95b1e3fa10fe2072656e737af195601c316c074a74be0012c7e00e21216f778017b227b44015a290211ee3c7
|
7
|
+
data.tar.gz: 53127db49e7925d0878ebf65a61251c44d63ffc8abf4c3a7c79ffa2f0a0c2b510c8d177093a8a6a29eac29b56a0335551e20ed9327ff72d9681ada72afd88f55
|
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,5 +1,19 @@
|
|
1
1
|
# sidekiq_publisher
|
2
2
|
|
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
|
+
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
|
+
|
3
17
|
## v1.7.0
|
4
18
|
- Add instrumentation using `ActiveSupport::Notifications`.
|
5
19
|
- Reimplement `metrics_reporter` and `exception_reporter` support using
|
data/Dockerfile
CHANGED
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.
|
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:
|
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
|
data/lib/sidekiq_publisher.rb
CHANGED
@@ -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/
|
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
|
5
|
-
|
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,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
|
data/sidekiq_publisher.gemspec
CHANGED
@@ -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.
|
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:
|
4
|
+
version: 2.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:
|
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.
|
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.
|
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,7 +335,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
333
335
|
requirements:
|
334
336
|
- - ">="
|
335
337
|
- !ruby/object:Gem::Version
|
336
|
-
version: '
|
338
|
+
version: '2.6'
|
337
339
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
338
340
|
requirements:
|
339
341
|
- - ">="
|