sidekiq_alive 2.1.0 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6a2151aa5146a6a40096e4513702809296876a902a7def0d24d59bad6f110da
4
- data.tar.gz: b99cd52eb4e5b694b6ca23d9b141d59b1ce362f914b74c63ea42b741dd4d7206
3
+ metadata.gz: 45d77df41c90efdbcb9ef9c1faa749cfeca83725eddf9d91714ff537faaa7348
4
+ data.tar.gz: f74f776df3b92e098b8b6178e3a114056d9d09fe975d42062ed8dd91d17ec4db
5
5
  SHA512:
6
- metadata.gz: e82159d26a9e62445880b525619c11e6fe18d3f18378c72147de816d302efd7b3911aad3ff53c30fdd66982fa58ea4be7ff32ab3abd98c9f83f43127442c2db1
7
- data.tar.gz: d5911f55bbd93e93baee10a8f28466eab44ca21980b7922ab05cb697d0d5fc2bdc4a09a70336d6f4f61614ba85a148b1c576eeba3f455078f4a935cec649f1f8
6
+ metadata.gz: 2c0074d76de89030184eac7463a7227aeacb767c54d89a34e1cbb80253342a3378fcfec07cf91f04bba5a91cf4aec4b8608b992c4c83d3379fdb78bee45312be
7
+ data.tar.gz: 68a46cb3ed64998666966b8d45ae0d424946899877ae25367ec855d0e150b2b5a91e153af79cfa0d6fd78a92a25fcdd666674e8fa53138c81306a4547766cd51
@@ -0,0 +1,48 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [master]
13
+ pull_request:
14
+ branches: [master]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby-version: ["2.6", "2.7", "3.0"]
22
+ services:
23
+ # Label used to access the service container
24
+ redis:
25
+ # Docker Hub image
26
+ image: redis
27
+ # Set health checks to wait until redis has started
28
+ options: >-
29
+ --health-cmd "redis-cli ping"
30
+ --health-interval 10s
31
+ --health-timeout 5s
32
+ --health-retries 5
33
+ ports:
34
+ # Maps port 6379 on service container to the host
35
+ - 6379:6379
36
+
37
+ steps:
38
+ - uses: actions/checkout@v2
39
+ - name: Set up Ruby
40
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
41
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
42
+ # uses: ruby/setup-ruby@v1
43
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
44
+ with:
45
+ ruby-version: ${{ matrix.ruby-version }}
46
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
47
+ - name: Run tests
48
+ run: bundle exec rake
@@ -0,0 +1,41 @@
1
+ name: Ruby CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ ruby-version: [3.0.x, 2.7.x, 2.6.x, 2.5.x]
16
+ # Service containers to run with `runner-job`
17
+ services:
18
+ # Label used to access the service container
19
+ redis:
20
+ # Docker Hub image
21
+ image: redis
22
+ # Set health checks to wait until redis has started
23
+ options: >-
24
+ --health-cmd "redis-cli ping"
25
+ --health-interval 10s
26
+ --health-timeout 5s
27
+ --health-retries 5
28
+ ports:
29
+ # Maps port 6379 on service container to the host
30
+ - 6379:6379
31
+
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+ - name: Set up Ruby ${{ matrix.ruby-version }}
35
+ uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
36
+ with:
37
+ ruby-version: ${{ matrix.ruby-version }}
38
+ - name: Install dependencies
39
+ run: bundle install
40
+ - name: Run tests
41
+ run: bundle exec rspec
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.7.4
1
+ ruby 3.0.2
data/.travis.yml CHANGED
@@ -7,6 +7,8 @@ rvm:
7
7
  - 2.4.4
8
8
  - 2.5.5
9
9
  - 2.6.2
10
+ - 2.7.4
11
+ - 3.0.2
10
12
  - ruby-head
11
13
  matrix:
12
14
  allow_failures:
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sidekiq_alive (2.0.6)
4
+ sidekiq_alive (2.1.4)
5
5
  sidekiq
6
+ webrick
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
@@ -43,12 +44,13 @@ GEM
43
44
  rack (>= 1.5.0)
44
45
  rack-protection (>= 1.5.0)
45
46
  redis (>= 3.3.5, < 5)
47
+ webrick (1.7.0)
46
48
 
47
49
  PLATFORMS
48
50
  ruby
49
51
 
50
52
  DEPENDENCIES
51
- bundler (~> 1.16)
53
+ bundler (> 1.16)
52
54
  mock_redis
53
55
  pry
54
56
  rack-test
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SidekiqAlive
2
2
 
3
- [![Build Status](https://travis-ci.org/arturictus/sidekiq_alive.svg?branch=master)](https://travis-ci.org/arturictus/sidekiq_alive)
3
+ ![build](https://github.com/arturictus/sidekiq_alive/actions/workflows/ruby.yml/badge.svg)
4
4
  [![Maintainability](https://api.codeclimate.com/v1/badges/35c39124564ffeb0ce4e/maintainability)](https://codeclimate.com/github/arturictus/sidekiq_alive/maintainability)
5
5
  [![Test Coverage](https://api.codeclimate.com/v1/badges/35c39124564ffeb0ce4e/test_coverage)](https://codeclimate.com/github/arturictus/sidekiq_alive/test_coverage)
6
6
 
data/docker-compose.yml CHANGED
@@ -4,3 +4,4 @@ services:
4
4
  image: redis
5
5
  ports:
6
6
  - 6379:6379
7
+ network_mode: host
@@ -20,15 +20,15 @@ module SidekiqAlive
20
20
  end
21
21
 
22
22
  def set_defaults
23
- @host = ENV['SIDEKIQ_ALIVE_HOST'] || '0.0.0.0'
24
- @port = ENV['SIDEKIQ_ALIVE_PORT'] || 7433
25
- @path = ENV['SIDEKIQ_ALIVE_PATH'] || '/'
23
+ @host = ENV.fetch('SIDEKIQ_ALIVE_HOST', '0.0.0.0')
24
+ @port = ENV.fetch('SIDEKIQ_ALIVE_PORT', 7433)
25
+ @path = ENV.fetch('SIDEKIQ_ALIVE_PATH', '/')
26
26
  @liveness_key = 'SIDEKIQ::LIVENESS_PROBE_TIMESTAMP'
27
27
  @time_to_live = 10 * 60
28
28
  @callback = proc {}
29
29
  @registered_instance_key = 'SIDEKIQ_REGISTERED_INSTANCE'
30
30
  @queue_prefix = :sidekiq_alive
31
- @server = ENV['SIDEKIQ_ALIVE_SERVER'] || 'webrick'
31
+ @server = ENV.fetch('SIDEKIQ_ALIVE_SERVER', 'webrick')
32
32
  @custom_liveness_probe = proc { true }
33
33
  end
34
34
 
@@ -10,7 +10,7 @@ module SidekiqAlive
10
10
 
11
11
  Signal.trap('TERM') { handler.shutdown }
12
12
 
13
- handler.run(self, Port: port, Host: '0.0.0.0', AccessLog: [])
13
+ handler.run(self, Port: port, Host: host, AccessLog: [], Logger: SidekiqAlive.logger)
14
14
  end
15
15
 
16
16
  def host
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqAlive
4
- VERSION = '2.1.0'
4
+ VERSION = '2.1.4'
5
5
  end
data/lib/sidekiq_alive.rb CHANGED
@@ -52,7 +52,14 @@ module SidekiqAlive
52
52
  end
53
53
 
54
54
  def self.registered_instances
55
- redis.keys("#{config.registered_instance_key}::*")
55
+ deep_scan("#{config.registered_instance_key}::*")
56
+ end
57
+
58
+ def self.deep_scan(keyword, keys = [], cursor = 0)
59
+ next_cursor, found_keys = *redis { |r| r }.scan(cursor, match: keyword)
60
+ keys += found_keys
61
+ return keys if next_cursor == "0" || found_keys.blank?
62
+ deep_scan(keyword, keys, next_cursor)
56
63
  end
57
64
 
58
65
  def self.purge_pending_jobs
@@ -156,4 +163,4 @@ end
156
163
  require 'sidekiq_alive/worker'
157
164
  require 'sidekiq_alive/server'
158
165
 
159
- SidekiqAlive.start unless ENV['DISABLE_SIDEKIQ_ALIVE']
166
+ SidekiqAlive.start unless ENV.fetch('DISABLE_SIDEKIQ_ALIVE', '').casecmp("true") == 0
@@ -29,11 +29,12 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ['lib']
31
31
 
32
- spec.add_development_dependency 'bundler', '~> 1.16'
32
+ spec.add_development_dependency 'bundler', '> 1.16'
33
33
  spec.add_development_dependency 'mock_redis'
34
34
  spec.add_development_dependency 'rack-test'
35
35
  spec.add_development_dependency 'rake', '~> 13.0'
36
36
  spec.add_development_dependency 'rspec', '~> 3.0'
37
37
  spec.add_development_dependency 'rspec-sidekiq', '~> 3.0'
38
38
  spec.add_dependency 'sidekiq'
39
+ spec.add_dependency 'webrick'
39
40
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq_alive
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artur Pañach
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-09 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.16'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.16'
27
27
  - !ruby/object:Gem::Dependency
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webrick
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: |-
112
126
  SidekiqAlive offers a solution to add liveness probe of a Sidekiq instance.
113
127
 
@@ -125,6 +139,8 @@ executables: []
125
139
  extensions: []
126
140
  extra_rdoc_files: []
127
141
  files:
142
+ - ".github/workflows/ruby.yml"
143
+ - ".github/workflows/test.yml"
128
144
  - ".gitignore"
129
145
  - ".rspec"
130
146
  - ".tool-versions"
@@ -148,7 +164,7 @@ homepage: https://github.com/arturictus/sidekiq_alive
148
164
  licenses:
149
165
  - MIT
150
166
  metadata: {}
151
- post_install_message:
167
+ post_install_message:
152
168
  rdoc_options: []
153
169
  require_paths:
154
170
  - lib
@@ -163,8 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
179
  - !ruby/object:Gem::Version
164
180
  version: '0'
165
181
  requirements: []
166
- rubygems_version: 3.1.6
167
- signing_key:
182
+ rubygems_version: 3.2.22
183
+ signing_key:
168
184
  specification_version: 4
169
185
  summary: Liveness probe for sidekiq on Kubernetes deployments.
170
186
  test_files: []