sidekiq-process_manager 1.0.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -4
- data/README.md +2 -1
- data/lib/sidekiq/process_manager/manager.rb +10 -4
- data/lib/sidekiq/process_manager/version.rb +1 -1
- data/lib/sidekiq/process_manager.rb +0 -2
- data/sidekiq-process_manager.gemspec +16 -19
- metadata +3 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2a78729234d036fa287b95df003baddd2916c2158a15e82b1ef5c73c601f7de
|
4
|
+
data.tar.gz: 294f84dc31697ef19f19a96d3d860e68d7334aaf69c9f62539c4f3ca71b32907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bcc7015f1f41308ce67d6bdb3feecf5db53b6b690a7f876af190da8bf3ef76ce088784f2019a79156faf14417d5e087da782f18a6e53ac8d0da6228cea73014
|
7
|
+
data.tar.gz: 1f5a94f60260e94bb0a1c0a2203eab6380d97a60c8b7690a4bb7bf510e923074b019a2fe62763795b4003b36c4da80b109683a4d4026d33258359a7a5c96aa23
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,25 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
2
3
|
|
3
|
-
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
4
6
|
|
5
|
-
# 1.0.0
|
6
7
|
|
7
|
-
|
8
|
+
## [1.0.3] - 2021-05-19
|
9
|
+
### Fixed
|
10
|
+
- Restore bin dir to gem distribution
|
11
|
+
|
12
|
+
## [1.0.2] - 2021-05-19
|
13
|
+
### Added
|
14
|
+
- Support for sidekiq >= 6.1
|
15
|
+
- Set $0 to "sidekiq" so instrumentation libraries detecting sidekiq server from the command line will work.
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
- Minimum Ruby version 2.3
|
19
|
+
|
20
|
+
## [1.0.1] - 2020-02-20
|
21
|
+
### Changed
|
22
|
+
- Remove auto require of `sidekiq/cli` so `require: false` does not need to be specified in a Gemfile.
|
23
|
+
|
24
|
+
## [1.0.0] - 2019-11-27
|
25
|
+
- Initial release
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# Sidekiq::ProcessManager
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Continuous Integration](https://github.com/bdurand/sidekiq-process_manager/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/bdurand/sidekiq-process_manager/actions/workflows/continuous_integration.yml)
|
4
4
|
[![Maintainability](https://api.codeclimate.com/v1/badges/ed89164d480af0e1442e/maintainability)](https://codeclimate.com/github/bdurand/sidekiq-process_manager/maintainability)
|
5
|
+
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
|
5
6
|
|
6
7
|
This gem provides a command line script for managing [sidekiq](https://github.com/mperham/sidekiq) processes. It starts up a process that then forks multiple sidekiq processes and manages their life cycle. This is important for large sidekiq installations, since without it on MRI ruby, sidekiq will only use one CPU core. By starting multiple processes you make all cores available.
|
7
8
|
|
@@ -5,12 +5,11 @@ require "sidekiq"
|
|
5
5
|
module Sidekiq
|
6
6
|
module ProcessManager
|
7
7
|
class Manager
|
8
|
-
|
9
8
|
attr_reader :cli
|
10
9
|
|
11
10
|
def initialize(process_count: 1, prefork: false, preboot: nil, mode: nil, silent: false)
|
12
11
|
require "sidekiq/cli"
|
13
|
-
|
12
|
+
|
14
13
|
# Get the number of processes to fork
|
15
14
|
@process_count = process_count
|
16
15
|
raise ArgumentError.new("Process count must be greater than 1") if @process_count < 1
|
@@ -128,7 +127,12 @@ module Sidekiq
|
|
128
127
|
Sidekiq.options[:pidfile] = false
|
129
128
|
if @prefork
|
130
129
|
log_info("Pre-forking application")
|
131
|
-
|
130
|
+
# Prior to sidekiq 6.1 the method to boot the application was boot_system
|
131
|
+
if @cli.methods.include?(:boot_application) || @cli.private_methods.include?(:boot_application)
|
132
|
+
@cli.send(:boot_application)
|
133
|
+
else
|
134
|
+
@cli.send(:boot_system)
|
135
|
+
end
|
132
136
|
Sidekiq::ProcessManager.run_before_fork_hooks
|
133
137
|
elsif @preboot && !@preboot.empty?
|
134
138
|
if ::File.exist?(@preboot)
|
@@ -145,6 +149,8 @@ module Sidekiq
|
|
145
149
|
|
146
150
|
def start_child_process!
|
147
151
|
@pids << fork do
|
152
|
+
# Set $0 so instrumentation libraries detecting sidekiq from the command run will work properly.
|
153
|
+
$0 = File.join(File.dirname($0), "sidekiq")
|
148
154
|
@process_count = 0
|
149
155
|
@pids.clear
|
150
156
|
Sidekiq::ProcessManager.run_after_fork_hooks
|
@@ -156,7 +162,7 @@ module Sidekiq
|
|
156
162
|
|
157
163
|
def send_signal_to_children(signal)
|
158
164
|
log_info("Process manager trapped signal #{signal}")
|
159
|
-
@process_count = 0 if
|
165
|
+
@process_count = 0 if signal == :INT || signal == :TERM
|
160
166
|
@pids.each do |pid|
|
161
167
|
begin
|
162
168
|
log_info("Sending signal #{signal} to sidekiq process #{pid}")
|
@@ -3,40 +3,37 @@
|
|
3
3
|
require_relative "lib/sidekiq/process_manager/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
6
|
+
spec.name = "sidekiq-process_manager"
|
7
|
+
spec.version = Sidekiq::ProcessManager::VERSION
|
8
|
+
spec.authors = ["Brian Durand"]
|
9
|
+
spec.email = ["bbdurand@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary
|
12
|
-
spec.homepage
|
13
|
-
spec.license
|
11
|
+
spec.summary = "Process manager for forking and monitoring multiple sidekiq processes."
|
12
|
+
spec.homepage = "https://github.com/bdurand/sidekiq-process_manager"
|
13
|
+
spec.license = "MIT"
|
14
14
|
|
15
15
|
# Specify which files should be added to the gem when it is released.
|
16
16
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
-
ignore_files = %w
|
18
|
-
.
|
19
|
-
.travis.yml
|
17
|
+
ignore_files = %w[
|
18
|
+
.
|
20
19
|
Appraisals
|
21
20
|
Gemfile
|
22
21
|
Gemfile.lock
|
23
22
|
Rakefile
|
24
23
|
gemfiles/
|
25
24
|
spec/
|
26
|
-
|
27
|
-
spec.files
|
28
|
-
`git ls-files -z`.split("\x0").reject{ |f| ignore_files.any?{ |path| f.start_with?(path) } }
|
25
|
+
]
|
26
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| ignore_files.any? { |path| f.start_with?(path) } }
|
29
28
|
end
|
30
|
-
|
31
|
-
spec.
|
29
|
+
|
30
|
+
spec.bindir = "bin"
|
31
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
32
32
|
spec.require_paths = ["lib"]
|
33
33
|
|
34
|
-
spec.required_ruby_version =
|
34
|
+
spec.required_ruby_version = ">= 2.3"
|
35
35
|
|
36
36
|
spec.add_dependency "sidekiq", ">= 3.0"
|
37
37
|
|
38
38
|
spec.add_development_dependency "bundler"
|
39
|
-
spec.add_development_dependency "rake"
|
40
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
41
|
-
spec.add_development_dependency "appraisal"
|
42
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-process_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Durand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -38,48 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: appraisal
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
41
|
description:
|
84
42
|
email:
|
85
43
|
- bbdurand@gmail.com
|
@@ -109,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
67
|
requirements:
|
110
68
|
- - ">="
|
111
69
|
- !ruby/object:Gem::Version
|
112
|
-
version: 2.
|
70
|
+
version: '2.3'
|
113
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
72
|
requirements:
|
115
73
|
- - ">="
|