sidekiq-alive-next 2.2.0 → 2.2.1

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: 783e392caa595b779c30404aa7372fa6736acea3e05a6092980ed4b36ad42115
4
- data.tar.gz: e87aa55b018053382fe89501d68900f77f03997ef245e6878e3f45bf9260e8bc
3
+ metadata.gz: 2262ac5bd03e54f13b80361452b90a306b61e0058f1496bf4d73d5f8a41593f9
4
+ data.tar.gz: 32a79905ca77cdf401828c8ea0ba9e5067c97b487c52d54ef8912716f005ab74
5
5
  SHA512:
6
- metadata.gz: ce3325f94879b92c2847c0ddfc8e5a0cb1ea354d63344c2f897bd80b02e565556349fdb9ab71ab4a9328c66e0b747ded5adada03fd4c4362985e75ee040f9b0e
7
- data.tar.gz: 73be9c7a97a513b46e14f8e76e7669aaf7757858e3155b13e4f602d678b2d91ee3a027bdc595319f0bc8faef17f8ce8463740507d808a12ab30a6fdaa1370853
6
+ metadata.gz: edc3042d9d3655ee8caec0f0c4207f78f102a2aae7a9c719f3bab8d9e6f4786c7550b7aaedf9b400d147af87e7ae9a5dfdd6db89998531a6377180ff0d2becc8
7
+ data.tar.gz: 2df4f3673588024031eafcb03095233cc4efa66263fc9fb98e7d9a76191ebb4648b468a105594c0ec148031748f817469918fa68195aa73e6b6a0f83961ba5b2
@@ -1,146 +1,153 @@
1
- require 'sidekiq'
2
- require 'sidekiq/api'
3
- require 'singleton'
4
- require 'sidekiq_alive/version'
5
- require 'sidekiq_alive/config'
1
+ # rubocop:disable Naming/FileName
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require "sidekiq"
6
+ require "sidekiq/api"
7
+ require "singleton"
8
+ require "sidekiq_alive/version"
9
+ require "sidekiq_alive/config"
6
10
 
7
11
  module SidekiqAlive
8
- def self.start
9
- Sidekiq.configure_server do |sq_config|
10
- sq_config.on(:startup) do
11
- SidekiqAlive::Worker.sidekiq_options queue: current_queue
12
- (sq_config.respond_to?(:[]) ? sq_config[:queues] : sq_config.options[:queues]).unshift(current_queue)
12
+ class << self
13
+ def start
14
+ Sidekiq.configure_server do |sq_config|
15
+ sq_config.on(:startup) do
16
+ SidekiqAlive::Worker.sidekiq_options(queue: current_queue)
17
+ (sq_config.respond_to?(:[]) ? sq_config[:queues] : sq_config.options[:queues]).unshift(current_queue)
18
+
19
+ logger.info(startup_info)
20
+
21
+ register_current_instance
22
+ store_alive_key
23
+ SidekiqAlive::Worker.perform_async(hostname)
24
+ @server_pid = fork { SidekiqAlive::Server.run! }
25
+
26
+ logger.info(successful_startup_text)
27
+ end
28
+
29
+ sq_config.on(:quiet) do
30
+ unregister_current_instance
31
+ config.shutdown_callback.call
32
+ end
33
+
34
+ sq_config.on(:shutdown) do
35
+ Process.kill("TERM", @server_pid) unless @server_pid.nil?
36
+ Process.wait(@server_pid) unless @server_pid.nil?
37
+
38
+ unregister_current_instance
39
+ config.shutdown_callback.call
40
+ end
41
+ end
42
+ end
13
43
 
14
- logger.info(startup_info)
44
+ def current_queue
45
+ "#{config.queue_prefix}-#{hostname}"
46
+ end
15
47
 
16
- register_current_instance
17
- store_alive_key
18
- SidekiqAlive::Worker.perform_async(hostname)
19
- @server_pid = fork { SidekiqAlive::Server.run! }
48
+ def register_current_instance
49
+ register_instance(current_instance_register_key)
50
+ end
20
51
 
21
- logger.info(successful_startup_text)
22
- end
52
+ def unregister_current_instance
53
+ # Delete any pending jobs for this instance
54
+ logger.info(shutdown_info)
55
+ purge_pending_jobs
56
+ redis.del(current_instance_register_key)
57
+ end
23
58
 
24
- sq_config.on(:quiet) do
25
- unregister_current_instance
26
- config.shutdown_callback.call
59
+ def registered_instances
60
+ deep_scan("#{config.registered_instance_key}::*")
61
+ end
62
+
63
+ def deep_scan(keyword, keys = [], cursor = 0)
64
+ loop do
65
+ cursor, found_keys = SidekiqAlive.redis.scan(cursor, match: keyword, count: 1000)
66
+ keys += found_keys
67
+ break if cursor.to_i.zero?
27
68
  end
69
+ keys
70
+ end
28
71
 
29
- sq_config.on(:shutdown) do
30
- Process.kill('TERM', @server_pid) unless @server_pid.nil?
31
- Process.wait(@server_pid) unless @server_pid.nil?
72
+ def purge_pending_jobs
73
+ # TODO: Sidekiq 6 allows better way to find scheduled jobs
74
+ # https://github.com/mperham/sidekiq/wiki/API#scan
75
+ scheduled_set = Sidekiq::ScheduledSet.new
76
+ jobs = scheduled_set.select { |job| job.klass == "SidekiqAlive::Worker" && job.queue == current_queue }
77
+ logger.info("[SidekiqAlive] Purging #{jobs.count} pending for #{hostname}")
78
+ jobs.each(&:delete)
79
+ logger.info("[SidekiqAlive] Removing queue #{current_queue}")
80
+ Sidekiq::Queue.new(current_queue).clear
81
+ end
32
82
 
33
- unregister_current_instance
34
- config.shutdown_callback.call
35
- end
83
+ def current_instance_register_key
84
+ "#{config.registered_instance_key}::#{hostname}"
85
+ end
86
+
87
+ def store_alive_key
88
+ redis.set(current_lifeness_key,
89
+ Time.now.to_i,
90
+ ex: config.time_to_live.to_i)
91
+ end
92
+
93
+ def redis
94
+ Sidekiq.redis { |r| r }
95
+ end
96
+
97
+ def alive?
98
+ redis.ttl(current_lifeness_key) != -2
99
+ end
100
+
101
+ # CONFIG ---------------------------------------
102
+
103
+ def setup
104
+ yield(config)
105
+ end
106
+
107
+ def logger
108
+ config.logger || Sidekiq.logger
109
+ end
110
+
111
+ def config
112
+ @config ||= SidekiqAlive::Config.instance
113
+ end
114
+
115
+ def current_lifeness_key
116
+ "#{config.liveness_key}::#{hostname}"
117
+ end
118
+
119
+ def hostname
120
+ ENV["HOSTNAME"] || "HOSTNAME_NOT_SET"
121
+ end
122
+
123
+ def shutdown_info
124
+ "Shutting down sidekiq-alive!"
125
+ end
126
+
127
+ def startup_info
128
+ info = {
129
+ hostname: hostname,
130
+ port: config.port,
131
+ ttl: config.time_to_live,
132
+ queue: current_queue,
133
+ }
134
+
135
+ "Starting sidekiq-alive: #{info}"
136
+ end
137
+
138
+ def successful_startup_text
139
+ "Successfully started sidekiq-alive, registered instances: #{registered_instances.join("\n\s\s- ")}"
140
+ end
141
+
142
+ def register_instance(instance_name)
143
+ redis.set(instance_name, Time.now.to_i, ex: config.registration_ttl.to_i)
36
144
  end
37
- end
38
-
39
- def self.current_queue
40
- "#{config.queue_prefix}-#{hostname}"
41
- end
42
-
43
- def self.register_current_instance
44
- register_instance(current_instance_register_key)
45
- end
46
-
47
- def self.unregister_current_instance
48
- # Delete any pending jobs for this instance
49
- logger.info(shutdown_info)
50
- purge_pending_jobs
51
- redis.del(current_instance_register_key)
52
- end
53
-
54
- def self.registered_instances
55
- deep_scan("#{config.registered_instance_key}::*")
56
- end
57
-
58
- def self.deep_scan(keyword, keys = [], cursor = 0)
59
- loop do
60
- cursor, found_keys = SidekiqAlive.redis.scan(cursor, match: keyword, count: 1000)
61
- keys += found_keys
62
- break if cursor.to_i.zero?
63
- end
64
- keys
65
- end
66
-
67
- def self.purge_pending_jobs
68
- # TODO:
69
- # Sidekiq 6 allows better way to find scheduled jobs:
70
- # https://github.com/mperham/sidekiq/wiki/API#scan
71
- scheduled_set = Sidekiq::ScheduledSet.new
72
- jobs = scheduled_set.select { |job| job.klass == 'SidekiqAlive::Worker' && job.queue == current_queue }
73
- logger.info("[SidekiqAlive] Purging #{jobs.count} pending for #{hostname}")
74
- jobs.each(&:delete)
75
- logger.info("[SidekiqAlive] Removing queue #{current_queue}")
76
- Sidekiq::Queue.new(current_queue).clear
77
- end
78
-
79
- def self.current_instance_register_key
80
- "#{config.registered_instance_key}::#{hostname}"
81
- end
82
-
83
- def self.store_alive_key
84
- redis.set(current_lifeness_key,
85
- Time.now.to_i,
86
- ex: config.time_to_live.to_i)
87
- end
88
-
89
- def self.redis
90
- Sidekiq.redis { |r| r }
91
- end
92
-
93
- def self.alive?
94
- redis.ttl(current_lifeness_key) != -2
95
- end
96
-
97
- # CONFIG ---------------------------------------
98
-
99
- def self.setup
100
- yield(config)
101
- end
102
-
103
- def self.logger
104
- config.logger || Sidekiq.logger
105
- end
106
-
107
- def self.config
108
- @config ||= SidekiqAlive::Config.instance
109
- end
110
-
111
- def self.current_lifeness_key
112
- "#{config.liveness_key}::#{hostname}"
113
- end
114
-
115
- def self.hostname
116
- ENV['HOSTNAME'] || 'HOSTNAME_NOT_SET'
117
- end
118
-
119
- def self.shutdown_info
120
- 'Shutting down sidekiq-alive!'
121
- end
122
-
123
- def self.startup_info
124
- info = {
125
- hostname: hostname,
126
- port: config.port,
127
- ttl: config.time_to_live,
128
- queue: current_queue
129
- }
130
-
131
- "Starting sidekiq-alive: #{info}"
132
- end
133
-
134
- def self.successful_startup_text
135
- "Successfully started sidekiq-alive, registered instances: #{registered_instances.join("\n\s\s- ")}"
136
- end
137
-
138
- def self.register_instance(instance_name)
139
- redis.set(instance_name, Time.now.to_i, ex: config.registration_ttl.to_i)
140
- end
141
145
  end
146
+ end
147
+
148
+ require "sidekiq_alive/worker"
149
+ require "sidekiq_alive/server"
142
150
 
143
- require 'sidekiq_alive/worker'
144
- require 'sidekiq_alive/server'
151
+ SidekiqAlive.start unless ENV.fetch("DISABLE_SIDEKIQ_ALIVE", "").casecmp("true").zero?
145
152
 
146
- SidekiqAlive.start unless ENV.fetch('DISABLE_SIDEKIQ_ALIVE', '').casecmp('true').zero?
153
+ # rubocop:enable Naming/FileName
@@ -22,15 +22,15 @@ module SidekiqAlive
22
22
  end
23
23
 
24
24
  def set_defaults
25
- @host = ENV.fetch('SIDEKIQ_ALIVE_HOST', '0.0.0.0')
26
- @port = ENV.fetch('SIDEKIQ_ALIVE_PORT', 7433)
27
- @path = ENV.fetch('SIDEKIQ_ALIVE_PATH', '/')
28
- @liveness_key = 'SIDEKIQ::LIVENESS_PROBE_TIMESTAMP'
25
+ @host = ENV.fetch("SIDEKIQ_ALIVE_HOST", "0.0.0.0")
26
+ @port = ENV.fetch("SIDEKIQ_ALIVE_PORT", 7433)
27
+ @path = ENV.fetch("SIDEKIQ_ALIVE_PATH", "/")
28
+ @liveness_key = "SIDEKIQ::LIVENESS_PROBE_TIMESTAMP"
29
29
  @time_to_live = 10 * 60
30
30
  @callback = proc {}
31
- @registered_instance_key = 'SIDEKIQ_REGISTERED_INSTANCE'
31
+ @registered_instance_key = "SIDEKIQ_REGISTERED_INSTANCE"
32
32
  @queue_prefix = :"sidekiq-alive"
33
- @server = ENV.fetch('SIDEKIQ_ALIVE_SERVER', 'webrick')
33
+ @server = ENV.fetch("SIDEKIQ_ALIVE_SERVER", "webrick")
34
34
  @custom_liveness_probe = proc { true }
35
35
  @shutdown_callback = proc {}
36
36
  end
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rack'
3
+ require "rack"
4
4
 
5
5
  module SidekiqAlive
6
6
  class Server
7
7
  class << self
8
8
  def run!
9
- handler = Rack::Handler.get(server)
9
+ handler = Rack::Handler.get(server)
10
10
 
11
- Signal.trap('TERM') { handler.shutdown }
11
+ Signal.trap("TERM") { handler.shutdown }
12
12
 
13
13
  handler.run(self, Port: port, Host: host, AccessLog: [], Logger: SidekiqAlive.logger)
14
14
  end
@@ -31,9 +31,9 @@ module SidekiqAlive
31
31
 
32
32
  def call(env)
33
33
  if Rack::Request.new(env).path != path
34
- [404, {}, ['Not found']]
34
+ [404, {}, ["Not found"]]
35
35
  elsif SidekiqAlive.alive?
36
- [200, {}, ['Alive!']]
36
+ [200, {}, ["Alive!"]]
37
37
  else
38
38
  response = "Can't find the alive key"
39
39
  SidekiqAlive.logger.error(response)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqAlive
4
- VERSION = '2.2.0'
4
+ VERSION = "2.2.1"
5
5
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-alive-next
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrejs Cunskis
8
+ - Artur Pañach
8
9
  autorequire:
9
- bindir: exe
10
+ bindir: bin
10
11
  cert_chain: []
11
12
  date: 2022-10-15 00:00:00.000000000 Z
12
13
  dependencies:
@@ -94,6 +95,34 @@ dependencies:
94
95
  - - "~>"
95
96
  - !ruby/object:Gem::Version
96
97
  version: '3.0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rubocop-shopify
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '2.10'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '2.10'
112
+ - !ruby/object:Gem::Dependency
113
+ name: solargraph
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: 0.47.2
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: 0.47.2
97
126
  - !ruby/object:Gem::Dependency
98
127
  name: sidekiq
99
128
  requirement: !ruby/object:Gem::Requirement
@@ -134,50 +163,38 @@ dependencies:
134
163
  - - "<"
135
164
  - !ruby/object:Gem::Version
136
165
  version: '2'
137
- description: |-
166
+ description: |
138
167
  SidekiqAlive offers a solution to add liveness probe of a Sidekiq instance.
139
168
 
140
- How?
169
+ How?
141
170
 
142
- A http server is started and on each requests validates that a liveness key is stored in Redis. If it is there means is working.
171
+ A http server is started and on each requests validates that a liveness key is stored in Redis. If it is there means is working.
143
172
 
144
- A Sidekiq job is the responsable to storing this key. If Sidekiq stops processing jobs
145
- this key gets expired by Redis an consequently the http server will return a 500 error.
173
+ A Sidekiq job is the responsable to storing this key. If Sidekiq stops processing jobs
174
+ this key gets expired by Redis an consequently the http server will return a 500 error.
146
175
 
147
- This Job is responsible to requeue itself for the next liveness probe.
176
+ This Job is responsible to requeue itself for the next liveness probe.
148
177
  email:
149
178
  - andrejs.cunskis@gmail.com
150
179
  executables: []
151
180
  extensions: []
152
181
  extra_rdoc_files: []
153
182
  files:
154
- - ".github/dependabot.yml"
155
- - ".github/release.yml"
156
- - ".github/workflows/release.yml"
157
- - ".github/workflows/test.yml"
158
- - ".gitignore"
159
- - ".rspec"
160
- - ".ruby-version"
161
- - ".tool-versions"
162
- - CODE_OF_CONDUCT.md
163
- - Gemfile
164
- - Gemfile.lock
165
- - LICENSE.txt
166
183
  - README.md
167
- - Rakefile
168
- - bin/console
169
- - bin/setup
170
- - docker-compose.yml
171
184
  - lib/sidekiq-alive-next.rb
172
185
  - lib/sidekiq_alive/config.rb
173
186
  - lib/sidekiq_alive/server.rb
174
187
  - lib/sidekiq_alive/version.rb
175
188
  - lib/sidekiq_alive/worker.rb
176
- - sidekiq_alive.gemspec
177
189
  homepage: https://github.com/andrcuns/sidekiq-alive
178
190
  licenses:
179
191
  - MIT
180
- metadata: {}
192
+ metadata:
193
+ homepage_uri: https://github.com/andrcuns/sidekiq-alive
194
+ source_code_uri: https://github.com/andrcuns/sidekiq-alive
195
+ changelog_uri: https://github.com/andrcuns/sidekiq-alive/releases
196
+ documentation_uri: https://github.com/andrcuns/sidekiq-alive/blob/v2.2.1/README.md
197
+ bug_tracker_uri: https://github.com/andrcuns/sidekiq-alive/issues
181
198
  post_install_message:
182
199
  rdoc_options: []
183
200
  require_paths:
@@ -186,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
203
  requirements:
187
204
  - - ">="
188
205
  - !ruby/object:Gem::Version
189
- version: '0'
206
+ version: 2.7.0
190
207
  required_rubygems_version: !ruby/object:Gem::Requirement
191
208
  requirements:
192
209
  - - ">="
@@ -1,16 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: "bundler"
4
- directory: "/"
5
- schedule:
6
- interval: "daily"
7
- reviewers:
8
- - "andrcuns"
9
- - package-ecosystem: github-actions
10
- directory: "/"
11
- schedule:
12
- interval: "daily"
13
- reviewers:
14
- - andrcuns
15
- labels:
16
- - "ci"
data/.github/release.yml DELETED
@@ -1,23 +0,0 @@
1
- changelog:
2
- categories:
3
- - title: '🚀 New Features'
4
- labels:
5
- - 'feature'
6
- - title: '🔬 Improvements'
7
- labels:
8
- - 'enhancement'
9
- - title: '🐞 Bug Fixes'
10
- labels:
11
- - 'bug'
12
- - title: '📦 Dependency updates'
13
- labels:
14
- - 'dependencies'
15
- - title: '📄 Documentation updates'
16
- labels:
17
- - 'documentation'
18
- - title: '🧰 Maintenance'
19
- labels:
20
- - 'maintenance'
21
- - title: '👷 CI'
22
- labels:
23
- - 'ci'
@@ -1,40 +0,0 @@
1
- name: Release
2
-
3
- on: workflow_dispatch
4
-
5
- jobs:
6
- release:
7
- name: Ruby gem
8
- runs-on: ubuntu-latest
9
- steps:
10
- -
11
- name: Checkout
12
- uses: actions/checkout@v3
13
- -
14
- name: Set up Ruby 3.1
15
- uses: ruby/setup-ruby@v1
16
- with:
17
- ruby-version: 3.1.2
18
- bundler-cache: true
19
- -
20
- name: Create tag and push to rubygems
21
- run: |
22
- git config user.name github-actions
23
- git config user.email github-actions@github.com
24
- bundle exec rake release
25
- env:
26
- GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
27
-
28
- gh-release:
29
- name: Github release
30
- runs-on: ubuntu-latest
31
- needs: release
32
- steps:
33
- -
34
- name: Checkout
35
- uses: actions/checkout@v3
36
- -
37
- uses: softprops/action-gh-release@v1
38
- with:
39
- token: ${{ secrets.GITHUB_TOKEN }}
40
- generate_release_notes: true
@@ -1,45 +0,0 @@
1
- name: Test
2
-
3
- on:
4
- push:
5
- branches:
6
- - master
7
- pull_request:
8
- branches:
9
- - master
10
-
11
- jobs:
12
- test:
13
- runs-on: ubuntu-latest
14
-
15
- strategy:
16
- fail-fast: false
17
- matrix:
18
- ruby-version: ["3.1", "3.0", "2.7"]
19
- # Service containers to run with `runner-job`
20
- services:
21
- # Label used to access the service container
22
- redis:
23
- # Docker Hub image
24
- image: redis
25
- # Set health checks to wait until redis has started
26
- options: >-
27
- --health-cmd "redis-cli ping"
28
- --health-interval 10s
29
- --health-timeout 5s
30
- --health-retries 5
31
- ports:
32
- # Maps port 6379 on service container to the host
33
- - 6379:6379
34
-
35
- steps:
36
- - uses: actions/checkout@v3
37
- - name: Set up Ruby ${{ matrix.ruby-version }}
38
- uses: ruby/setup-ruby@v1
39
- with:
40
- ruby-version: ${{ matrix.ruby-version }}
41
- bundler-cache: true
42
- - name: Install dependencies
43
- run: bundle install
44
- - name: Run tests
45
- run: bundle exec rspec --color
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
- vendor
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
4
- --order random
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.0.4
data/.tool-versions DELETED
@@ -1 +0,0 @@
1
- ruby 3.0.4
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at arturictus@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in sidekiq_alive.gemspec
6
- gemspec
7
-
8
- gem 'pry'
data/Gemfile.lock DELETED
@@ -1,64 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- sidekiq-alive-next (2.2.0)
5
- sidekiq (>= 5, < 7)
6
- webrick (>= 1, < 2)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- coderay (1.1.3)
12
- connection_pool (2.3.0)
13
- diff-lcs (1.5.0)
14
- method_source (1.0.0)
15
- mock_redis (0.34.0)
16
- ruby2_keywords
17
- pry (0.14.1)
18
- coderay (~> 1.1)
19
- method_source (~> 1.0)
20
- rack (2.2.4)
21
- rack-test (2.0.2)
22
- rack (>= 1.3)
23
- rake (13.0.6)
24
- redis (4.8.0)
25
- rspec (3.11.0)
26
- rspec-core (~> 3.11.0)
27
- rspec-expectations (~> 3.11.0)
28
- rspec-mocks (~> 3.11.0)
29
- rspec-core (3.11.0)
30
- rspec-support (~> 3.11.0)
31
- rspec-expectations (3.11.1)
32
- diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.11.0)
34
- rspec-mocks (3.11.1)
35
- diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.11.0)
37
- rspec-sidekiq (3.1.0)
38
- rspec-core (~> 3.0, >= 3.0.0)
39
- sidekiq (>= 2.4.0)
40
- rspec-support (3.11.1)
41
- ruby2_keywords (0.0.5)
42
- sidekiq (6.5.7)
43
- connection_pool (>= 2.2.5)
44
- rack (~> 2.0)
45
- redis (>= 4.5.0, < 5)
46
- webrick (1.7.0)
47
-
48
- PLATFORMS
49
- aarch64-linux
50
- arm64-darwin-21
51
- x86_64-linux
52
-
53
- DEPENDENCIES
54
- bundler (> 1.16)
55
- mock_redis
56
- pry
57
- rack-test
58
- rake (~> 13.0)
59
- rspec (~> 3.0)
60
- rspec-sidekiq (~> 3.0)
61
- sidekiq-alive-next!
62
-
63
- BUNDLED WITH
64
- 2.3.22
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2018 Artur Pañach
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'sidekiq_alive'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/docker-compose.yml DELETED
@@ -1,6 +0,0 @@
1
- version: '3.6'
2
- services:
3
- redis:
4
- image: redis
5
- ports:
6
- - 6379:6379
@@ -1,40 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'sidekiq_alive/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'sidekiq-alive-next'
7
- spec.version = SidekiqAlive::VERSION
8
- spec.authors = ['Andrejs Cunskis']
9
- spec.email = ['andrejs.cunskis@gmail.com']
10
-
11
- spec.summary = 'Liveness probe for sidekiq on Kubernetes deployments.'
12
- spec.description = 'SidekiqAlive offers a solution to add liveness probe of a Sidekiq instance.
13
-
14
- How?
15
-
16
- A http server is started and on each requests validates that a liveness key is stored in Redis. If it is there means is working.
17
-
18
- A Sidekiq job is the responsable to storing this key. If Sidekiq stops processing jobs
19
- this key gets expired by Redis an consequently the http server will return a 500 error.
20
-
21
- This Job is responsible to requeue itself for the next liveness probe.'
22
- spec.homepage = 'https://github.com/andrcuns/sidekiq-alive'
23
- spec.license = 'MIT'
24
-
25
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
- f.match(%r{^(test|spec|features)/})
27
- end
28
- spec.bindir = 'exe'
29
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
- spec.require_paths = ['lib']
31
-
32
- spec.add_development_dependency 'bundler', '> 1.16'
33
- spec.add_development_dependency 'mock_redis'
34
- spec.add_development_dependency 'rack-test'
35
- spec.add_development_dependency 'rake', '~> 13.0'
36
- spec.add_development_dependency 'rspec', '~> 3.0'
37
- spec.add_development_dependency 'rspec-sidekiq', '~> 3.0'
38
- spec.add_dependency 'sidekiq', '>= 5', '< 7'
39
- spec.add_dependency 'webrick', '>= 1', '< 2'
40
- end