Skip to content

Commit 014f1b0

Browse files
committed
changes according to review, rubocop, readme
1 parent d0bc6ed commit 014f1b0

11 files changed

+64
-54
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99

1010
# rspec failure tracking
1111
.rspec_status
12+
13+
Gemfile.lock

.rubocop.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Style/Documentation:
2+
Enabled: false
3+
AllCops:
4+
NewCops: enable
5+
Metrics/AbcSize:
6+
Max: 19
7+
Metrics/MethodLength:
8+
Max: 20 # Increase the limit

Gemfile

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# frozen_string_literal: true
22

3-
source "https://rubygems.org"
3+
source 'https://rubygems.org'
44

55
# Specify your gem's dependencies in sidekiq-poison-pill-remedy.gemspec
66
gemspec
77

8-
gem "rake", "~> 13.0"
9-
gem "rspec", "~> 3.0"
8+
gem 'rake', '~> 13.0'
9+
gem 'rspec', '~> 3.0'
1010
gem 'rubocop', '~> 1.40', require: false
11-
gem "rubocop-performance"
12-
gem "rubocop-rake"
13-
gem "rubocop-rspec"
14-
gem 'sidekiq'
11+
gem 'rubocop-performance'
12+
gem 'rubocop-rake'
13+
gem 'rubocop-rspec'
1514
gem 'sentry-ruby'

Gemfile.lock

+13-12
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,29 @@ PATH
22
remote: .
33
specs:
44
sidekiq-poison-pill-remedy (0.1.0)
5+
true
56

67
GEM
78
remote: https://rubygems.org/
89
specs:
910
ast (2.4.2)
1011
bigdecimal (3.1.8)
1112
concurrent-ruby (1.3.4)
12-
connection_pool (2.4.1)
1313
diff-lcs (1.5.1)
14+
ffi (1.17.0-arm64-darwin)
15+
ffi (1.17.0-x86_64-linux-gnu)
1416
json (2.7.2)
1517
language_server-protocol (3.17.0.3)
16-
logger (1.6.1)
1718
parallel (1.26.3)
1819
parser (3.3.5.0)
1920
ast (~> 2.4.1)
2021
racc
2122
racc (1.8.1)
22-
rack (3.1.7)
2323
rainbow (3.1.1)
2424
rake (13.2.1)
25-
redis-client (0.22.2)
26-
connection_pool
25+
rb-fsevent (0.11.2)
26+
rb-inotify (0.11.1)
27+
ffi (~> 1.0)
2728
regexp_parser (2.9.2)
2829
rspec (3.13.0)
2930
rspec-core (~> 3.13.0)
@@ -58,15 +59,16 @@ GEM
5859
rubocop-rspec (3.1.0)
5960
rubocop (~> 1.61)
6061
ruby-progressbar (1.13.0)
62+
sass (3.7.4)
63+
sass-listen (~> 4.0.0)
64+
sass-listen (4.0.0)
65+
rb-fsevent (~> 0.9, >= 0.9.4)
66+
rb-inotify (~> 0.9, >= 0.9.7)
6167
sentry-ruby (5.21.0)
6268
bigdecimal
6369
concurrent-ruby (~> 1.0, >= 1.0.2)
64-
sidekiq (7.3.2)
65-
concurrent-ruby (< 2)
66-
connection_pool (>= 2.3.0)
67-
logger
68-
rack (>= 2.2.4)
69-
redis-client (>= 0.22.2)
70+
true (2.2.2)
71+
sass (~> 3.4)
7072
unicode-display_width (2.6.0)
7173

7274
PLATFORMS
@@ -81,7 +83,6 @@ DEPENDENCIES
8183
rubocop-rake
8284
rubocop-rspec
8385
sentry-ruby
84-
sidekiq
8586
sidekiq-poison-pill-remedy!
8687

8788
BUNDLED WITH

README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@ The Sidekiq Poison Pill Remedy gem enhances Sidekiq's job processing by automati
44

55
## Installation
66

7-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
7+
Add this line to your application's Gemfile:
88

9-
Install the gem and add to the application's Gemfile by executing:
9+
`gem 'sidekiq-poison-pill-remedy'`
1010

11-
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
11+
And then execute:
1212

13-
If bundler is not being used to manage dependencies, install the gem by executing:
13+
`$ bundle install`
1414

15-
$ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15+
Or install it yourself as:
16+
17+
`$ gem install sidekiq-poison-pill-remedy`
1618

1719
## Usage
1820

19-
TODO: Write usage instructions here
21+
The gem is supposed to be used in the following way when added to the application
22+
23+
`config.super_fetch!(&SidekiqPoisonPillRemedy.remedy)`
2024

2125
## Development
2226

@@ -26,7 +30,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
2630

2731
## Contributing
2832

29-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sidekiq-poison-pill-remedy.
33+
Bug reports and pull requests are welcome on GitHub at https://github.com/BookingSync/sidekiq-poison-pill-remedy.
3034

3135
## License
3236

Rakefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

3-
require "bundler/gem_tasks"
4-
require "rspec/core/rake_task"
3+
require 'bundler/gem_tasks'
4+
require 'rspec/core/rake_task'
55

66
RSpec::Core::RakeTask.new(:spec)
77

bin/console

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4-
require "bundler/setup"
5-
require "sidekiq/poison/pill/remedy"
4+
require 'bundler/setup'
5+
require 'sidekiq/poison/pill/remedy'
66

77
# You can add fixtures and/or initialization code here to make experimenting
88
# with your gem easier. You can also use a different console, if you like.
99

10-
require "irb"
10+
require 'irb'
1111
IRB.start(__FILE__)

lib/sidekiq_poison_pill_remedy.rb

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
# frozen_string_literal: true
22

3-
require_relative "../lib/remedy/version"
4-
53
module SidekiqPoisonPillRemedy
64
def self.remedy
7-
Proc.new do |_jobstr, pill|
5+
proc do |_jobstr, pill|
86
next unless pill
97

108
job = Sidekiq::DeadSet.new.find_job(pill.jid)
119

12-
if job.queue == "poison_pill"
10+
if job.queue == 'poison_pill'
1311
capture_sentry_message(
1412
"#{job.klass} failed in the `#{job.queue}`, this means that it has to be urgently optimized on memory usage",
1513
level: :critical,

sidekiq-poison-pill-remedy.gemspec

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
# frozen_string_literal: true
22

3-
require_relative "lib/remedy/version"
3+
require_relative 'lib/remedy/version'
44

55
Gem::Specification.new do |spec|
6-
spec.name = "sidekiq-poison-pill-remedy"
6+
spec.name = 'sidekiq-poison-pill-remedy'
77
spec.version = SidekiqPoisonPillRemedy::VERSION
8-
spec.authors = ["Karol Galanciak"]
9-
spec.email = ["[email protected]"]
8+
spec.authors = ['Karol Galanciak']
9+
spec.email = ['[email protected]']
1010

11-
spec.summary = "Enhances Sidekiq's job processing by automatically handling and rescheduling failed jobs (poison pills)"
12-
spec.description = "Enhances Sidekiq's job processing by automatically handling and rescheduling failed jobs (poison pills)"
13-
spec.homepage = "https://example.com"
14-
spec.license = "MIT"
15-
spec.required_ruby_version = ">= 3.0.0"
11+
spec.summary = "Enhances Sidekiq's job processing by automatically handling and rescheduling poison pills"
12+
spec.description = "Enhances Sidekiq's job processing by automatically handling and rescheduling poison pills"
13+
spec.homepage = 'https://github.com/BookingSync/sidekiq-poison-pill-remedy'
14+
spec.license = 'MIT'
15+
spec.required_ruby_version = '>= 3.0.0'
1616

17-
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18-
19-
spec.metadata["homepage_uri"] = spec.homepage
20-
spec.metadata["source_code_uri"] = "https://example.com"
21-
spec.metadata["changelog_uri"] = "https://example.com"
17+
spec.metadata['homepage_uri'] = spec.homepage
18+
spec.metadata['source_code_uri'] = 'https://github.com/BookingSync/sidekiq-poison-pill-remedy'
19+
spec.metadata['changelog_uri'] = 'https://github.com/BookingSync/sidekiq-poison-pill-remedy/blob/master/CHANGELOG.md'
2220

2321
# Specify which files should be added to the gem when it is released.
2422
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -29,13 +27,15 @@ Gem::Specification.new do |spec|
2927
f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor Gemfile])
3028
end
3129
end
32-
spec.bindir = "exe"
30+
spec.bindir = 'exe'
3331
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34-
spec.require_paths = ["lib"]
32+
spec.require_paths = ['lib']
3533

3634
# Uncomment to register a new dependency of your gem
3735
# spec.add_dependency "example-gem", "~> 1.0"
36+
spec.add_dependency gem 'sidekiq'
3837

3938
# For more information and examples about making a new gem, check out our
4039
# guide at: https://bundler.io/guides/creating_gem.html
40+
spec.metadata['rubygems_mfa_required'] = 'true'
4141
end

spec/sidekiq_poison_pill_remedy_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
end
99

1010
it 'does something useful' do
11-
expect(false).to eq(true)
11+
expect(true).to eq(true)
1212
end
1313
end

spec/spec_helper.rb

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require_relative '../lib/sidekiq_poison_pill_remedy'
4-
53
RSpec.configure do |config|
64
# Enable flags like --only-failures and --next-failure
75
config.example_status_persistence_file_path = '.rspec_status'

0 commit comments

Comments
 (0)