process_bot 0.1.4 → 0.1.5

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: 24914d42c043171014a4dacebea43987204236a2dadb14d2fcc4f8bda936e628
4
- data.tar.gz: b9248c4189e0d52826728401e940bed7ba46e330fb7f391d587ba00f23b160e3
3
+ metadata.gz: 8ba4b3227493fa167bf23dfa8338ab83baf626a444eb91ff98d8d7ce40056cc2
4
+ data.tar.gz: 605f53e2980a549cb945470e6010877ce2b4eed5f5adef5dd7c80f2f46976332
5
5
  SHA512:
6
- metadata.gz: a92b6568aaf9e799f5d318cd63c900185c4f6cacb4578c7f6fc3769933e571b27b7f48f27d7c33a93ce700d5e3990ea53c0f50a5b39c31ae9153130502c770bc
7
- data.tar.gz: 3eb45c1dd31b202ac80b0c1b7925e60ed682fd5f42210a768459c6b456d84b9a76cc7618b67ead9f576482ded5b9d47501039d51d158a5125bfab258097c43ff
6
+ metadata.gz: cf82581d6d23036f2bbd5a91587f752b89d45e5c24a045193acd24911eb7ef5e427991baa7d0c6bb9299207c0c67595b4b645fb13743737e5771fde19063edba
7
+ data.tar.gz: 49f2aeca472a0a5957b86f70db38be1516faf8503ba04b70108e6ef8bf91b40b1bd2cb241339e79b447ba47290e47a25c81568cf516fbfa057a0745742f7e061
data/Gemfile.lock CHANGED
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- process_bot (0.1.4)
4
+ process_bot (0.1.5)
5
5
  knjrbfw (>= 0.0.116)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- ast (2.4.2)
10
+ ast (2.4.3)
11
11
  coderay (1.1.3)
12
12
  datet (0.0.25)
13
- diff-lcs (1.5.0)
13
+ diff-lcs (1.5.1)
14
14
  http2 (0.0.36)
15
15
  string-cases (~> 0)
16
- json (2.7.0)
16
+ json (2.10.2)
17
17
  knjrbfw (0.0.116)
18
18
  datet
19
19
  http2
@@ -21,63 +21,63 @@ GEM
21
21
  ruby_process
22
22
  tsafe
23
23
  wref (>= 0.0.8)
24
- language_server-protocol (3.17.0.3)
25
- method_source (1.0.0)
26
- parallel (1.23.0)
27
- parser (3.2.2.4)
24
+ language_server-protocol (3.17.0.4)
25
+ lint_roller (1.1.0)
26
+ method_source (1.1.0)
27
+ parallel (1.26.3)
28
+ parser (3.3.7.4)
28
29
  ast (~> 2.4.1)
29
30
  racc
30
31
  php4r (0.0.4)
31
32
  datet
32
33
  http2
33
34
  string-strtr
34
- pry (0.14.2)
35
+ prism (1.4.0)
36
+ pry (0.15.2)
35
37
  coderay (~> 1.1)
36
38
  method_source (~> 1.0)
37
- racc (1.7.3)
39
+ racc (1.8.1)
38
40
  rainbow (3.1.1)
39
- rake (13.1.0)
40
- regexp_parser (2.8.2)
41
- rexml (3.2.6)
42
- rspec (3.12.0)
43
- rspec-core (~> 3.12.0)
44
- rspec-expectations (~> 3.12.0)
45
- rspec-mocks (~> 3.12.0)
46
- rspec-core (3.12.0)
47
- rspec-support (~> 3.12.0)
48
- rspec-expectations (3.12.0)
41
+ rake (13.2.1)
42
+ ref (2.0.0)
43
+ regexp_parser (2.10.0)
44
+ rspec (3.13.0)
45
+ rspec-core (~> 3.13.0)
46
+ rspec-expectations (~> 3.13.0)
47
+ rspec-mocks (~> 3.13.0)
48
+ rspec-core (3.13.0)
49
+ rspec-support (~> 3.13.0)
50
+ rspec-expectations (3.13.0)
49
51
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.12.0)
51
- rspec-mocks (3.12.0)
52
+ rspec-support (~> 3.13.0)
53
+ rspec-mocks (3.13.0)
52
54
  diff-lcs (>= 1.2.0, < 2.0)
53
- rspec-support (~> 3.12.0)
54
- rspec-support (3.12.0)
55
- rubocop (1.58.0)
55
+ rspec-support (~> 3.13.0)
56
+ rspec-support (3.13.0)
57
+ rubocop (1.75.2)
56
58
  json (~> 2.3)
57
- language_server-protocol (>= 3.17.0)
59
+ language_server-protocol (~> 3.17.0.2)
60
+ lint_roller (~> 1.1.0)
58
61
  parallel (~> 1.10)
59
- parser (>= 3.2.2.4)
62
+ parser (>= 3.3.0.2)
60
63
  rainbow (>= 2.2.2, < 4.0)
61
- regexp_parser (>= 1.8, < 3.0)
62
- rexml (>= 3.2.5, < 4.0)
63
- rubocop-ast (>= 1.30.0, < 2.0)
64
+ regexp_parser (>= 2.9.3, < 3.0)
65
+ rubocop-ast (>= 1.44.0, < 2.0)
64
66
  ruby-progressbar (~> 1.7)
65
- unicode-display_width (>= 2.4.0, < 3.0)
66
- rubocop-ast (1.30.0)
67
- parser (>= 3.2.1.0)
68
- rubocop-capybara (2.19.0)
69
- rubocop (~> 1.41)
70
- rubocop-factory_bot (2.24.0)
71
- rubocop (~> 1.33)
72
- rubocop-performance (1.19.1)
73
- rubocop (>= 1.7.0, < 2.0)
74
- rubocop-ast (>= 0.4.0)
75
- rubocop-rake (0.6.0)
76
- rubocop (~> 1.0)
77
- rubocop-rspec (2.25.0)
78
- rubocop (~> 1.40)
79
- rubocop-capybara (~> 2.17)
80
- rubocop-factory_bot (~> 2.22)
67
+ unicode-display_width (>= 2.4.0, < 4.0)
68
+ rubocop-ast (1.44.0)
69
+ parser (>= 3.3.7.2)
70
+ prism (~> 1.4)
71
+ rubocop-performance (1.25.0)
72
+ lint_roller (~> 1.1)
73
+ rubocop (>= 1.75.0, < 2.0)
74
+ rubocop-ast (>= 1.38.0, < 2.0)
75
+ rubocop-rake (0.7.1)
76
+ lint_roller (~> 1.1)
77
+ rubocop (>= 1.72.1)
78
+ rubocop-rspec (3.5.0)
79
+ lint_roller (~> 1.1)
80
+ rubocop (~> 1.72, >= 1.72.1)
81
81
  ruby-progressbar (1.13.0)
82
82
  ruby_process (0.0.13)
83
83
  string-cases
@@ -86,8 +86,11 @@ GEM
86
86
  string-cases (0.0.4)
87
87
  string-strtr (0.0.3)
88
88
  tsafe (0.0.12)
89
- unicode-display_width (2.5.0)
90
- wref (0.0.8)
89
+ unicode-display_width (3.1.4)
90
+ unicode-emoji (~> 4.0, >= 4.0.4)
91
+ unicode-emoji (4.0.4)
92
+ wref (0.0.11)
93
+ ref
91
94
 
92
95
  PLATFORMS
93
96
  ruby
data/README.md CHANGED
@@ -2,7 +2,10 @@
2
2
 
3
3
  Run your app through ProcessBot for automatic restart if crashing, but still support normal deployment through Capistrano.
4
4
 
5
- In the future ProcessBot will also watch memory usage and restart processes if leaking memory automatically and gracefully.
5
+ Watch memory usage for Sidekiq and restart gracefully if it exceeds a given limit (to counter memory leaks).
6
+
7
+ When deploying can gracefully exit Sidekiq to let long running jobs finish on old version of code, and start new Sidekiq processes after finishing deploy (but still let the old ones finish gracefully so nothing gets interrupted).
8
+ This requires not to remove columns, rename columns or any other intrusive database changes.
6
9
 
7
10
  ## Installation
8
11
 
@@ -1,28 +1,36 @@
1
1
  require "socket"
2
2
 
3
3
  class ProcessBot::ControlSocket
4
- attr_reader :options, :process, :server
4
+ attr_reader :options, :port, :process, :server
5
5
 
6
6
  def initialize(options:, process:)
7
7
  @options = options
8
8
  @process = process
9
+ @port = options.fetch(:port).to_i
9
10
  end
10
11
 
11
12
  def logger
12
13
  @logger ||= ProcessBot::Logger.new(options: options)
13
14
  end
14
15
 
15
- def port
16
- options.fetch(:port).to_i
17
- end
18
-
19
16
  def start
20
- @server = TCPServer.new("localhost", port)
17
+ start_tcp_server
21
18
  run_client_loop
22
-
23
19
  logger.logs "TCPServer started"
20
+ options.events.call(:on_socket_opened, port: @port)
21
+ end
24
22
 
25
- options.events.call(:on_socket_opened, port: port)
23
+ def start_tcp_server
24
+ tries ||= 0
25
+ tries += 1
26
+ @server = TCPServer.new("localhost", @port)
27
+ rescue Errno::EADDRNOTAVAIL => e
28
+ if tries <= 100
29
+ @port += 1
30
+ retry
31
+ else
32
+ raise e
33
+ end
26
34
  end
27
35
 
28
36
  def stop
@@ -1,3 +1,3 @@
1
1
  module ProcessBot
2
- VERSION = "0.1.4".freeze
2
+ VERSION = "0.1.5".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-15 00:00:00.000000000 Z
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: knjrbfw
@@ -60,7 +60,6 @@ files:
60
60
  - lib/process_bot/process/runner.rb
61
61
  - lib/process_bot/version.rb
62
62
  - peak_flow.yml
63
- - process_bot.gemspec
64
63
  - sig/process_bot.rbs
65
64
  homepage: https://github.com/kaspernj/process_bot
66
65
  licenses:
@@ -71,7 +70,7 @@ metadata:
71
70
  source_code_uri: https://github.com/kaspernj/process_bot
72
71
  changelog_uri: https://github.com/kaspernj/process_bot/blob/master/CHANGELOG.md
73
72
  rubygems_mfa_required: 'true'
74
- post_install_message:
73
+ post_install_message:
75
74
  rdoc_options: []
76
75
  require_paths:
77
76
  - lib
@@ -86,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
85
  - !ruby/object:Gem::Version
87
86
  version: '0'
88
87
  requirements: []
89
- rubygems_version: 3.4.17
90
- signing_key:
88
+ rubygems_version: 3.1.6
89
+ signing_key:
91
90
  specification_version: 4
92
91
  summary: Run and control processes.
93
92
  test_files: []
data/process_bot.gemspec DELETED
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/process_bot/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "process_bot"
7
- spec.version = ProcessBot::VERSION
8
- spec.authors = ["kaspernj"]
9
- spec.email = ["k@spernj.org"]
10
-
11
- spec.summary = "Run and control processes."
12
- spec.description = "Run and control processes."
13
- spec.homepage = "https://github.com/kaspernj/process_bot"
14
- spec.license = "MIT"
15
- spec.required_ruby_version = ">= 2.7.0"
16
-
17
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
-
19
- spec.metadata["homepage_uri"] = spec.homepage
20
- spec.metadata["source_code_uri"] = "https://github.com/kaspernj/process_bot"
21
- spec.metadata["changelog_uri"] = "https://github.com/kaspernj/process_bot/blob/master/CHANGELOG.md"
22
-
23
- # Specify which files should be added to the gem when it is released.
24
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
- `git ls-files -z`.split("\x0").reject do |f|
27
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
- end
29
- end
30
- spec.bindir = "exe"
31
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
32
- spec.require_paths = ["lib"]
33
-
34
- spec.add_dependency "knjrbfw", ">= 0.0.116"
35
-
36
- spec.metadata["rubygems_mfa_required"] = "true"
37
- end