blue_green_process 0.1.4 → 0.1.4.2

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: c8905db7b63e35a80a3fa1272553fa4f84002e06747501b5749110a6edfed79e
4
- data.tar.gz: 467fbb4d348d6fae9cfc70a013f88a560cc69a97690451d0b53908585d312e20
3
+ metadata.gz: 864e404c1e622e26d8689695a3791b4cf6c84709127617a5d778b550cb03527c
4
+ data.tar.gz: 002bba05528b78c7be7184c74bbbf0b94418c12d01d3c93cda5883043b6c376b
5
5
  SHA512:
6
- metadata.gz: f042564e95f91038d87faaae43d891d798204784a27f0b2fb1a038df195717c58755c7a65531216d97f4477296dee1775119ba1c01560c7fb067a336c1b613aa
7
- data.tar.gz: 28d937c6280847b821ef49f4c247649549a13bf4a5c0f62d444cb6d5c391d88c491ac2d2fcca38a56947e4eb66b5583200885b4cc4e4f40c63cd61c2a8ac5bc1
6
+ metadata.gz: 511d89c74a5a24331cb3d4cc3e72aacf92d8eaed3cc2abcfc4e8964949fa2760fb311d3dd265f2ef185a35c53af70042fa2106b0c6297548793a4565fbc2de9b
7
+ data.tar.gz: ab4c37316936239229d153bc4c54747cb184319bd04438d16c81100c0dfc8346c27273727b57112cc9f8f764b91ca4daa28fea8f00d848f93774d216fcde9cbb
data/.rubocop.yml CHANGED
@@ -40,3 +40,6 @@ Metrics/ClassLength:
40
40
 
41
41
  Lint/AmbiguousBlockAssociation:
42
42
  Enabled: false
43
+
44
+ Layout/LineLength:
45
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- ## [0.1.4] - 2022-12-
1
+ ## [0.1.4.2] - 2022-12-25
2
+ * プロセス終了時にDRb.stop_serviceを呼ぶのをやめました
3
+
4
+ ## [0.1.4.1] - 2022-12-13
5
+ * プロセス終了時にDRb.stop_serviceを呼ぶようにしました
6
+
7
+ ## [0.1.4] - 2022-12-12
2
8
  * BlueGreenProcess.terminate_workers_immediately を呼び出すことで、シグナル経由で終了できるようになりました
3
9
 
4
10
  ## [0.1.3] - 2022-9-5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- blue_green_process (0.1.4)
4
+ blue_green_process (0.1.4.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "English"
3
4
  module BlueGreenProcess
4
5
  class ErrorWrapper < StandardError
5
6
  attr_accessor :error_class, :message
@@ -70,9 +71,7 @@ module BlueGreenProcess
70
71
  data: BlueGreenProcess::SharedVariable.data }.to_json)
71
72
  ::GC.start unless BlueGreenProcess::SharedVariable.extend_run_on_this_process
72
73
  when BlueGreenProcess::PROCESS_COMMAND_WORK
73
- if process_status == BlueGreenProcess::PROCESS_STATUS_INACTIVE
74
- warn "Should not be able to run in this status"
75
- end
74
+ warn "Should not be able to run in this status" if process_status == BlueGreenProcess::PROCESS_STATUS_INACTIVE
76
75
 
77
76
  begin
78
77
  worker_instance.work(*label)
@@ -159,8 +158,10 @@ module BlueGreenProcess
159
158
  while (readable_io = IO.select([self_read]))
160
159
  signal = readable_io.first[0].gets.strip
161
160
  case signal
162
- when "INT", "TERM"
161
+ when "TERM"
163
162
  raise Interrupt
163
+ when "INT"
164
+ BlueGreenProcess.logger.warn "[BLUE_GREEN_PROCESS][#{$PROCESS_ID}] INTシグナルは無視します"
164
165
  end
165
166
  end
166
167
  rescue Interrupt
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlueGreenProcess
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.4.2"
5
5
  end
@@ -57,6 +57,8 @@ module BlueGreenProcess
57
57
 
58
58
  # @return [void]
59
59
  def self.terminate_workers_immediately
60
+ BlueGreenProcess.logger.warn "[BLUE_GREEN_PROCESS][#{$PROCESS_ID}] TERMシグナルを送信します"
61
+
60
62
  worker_pids = nil
61
63
  begin
62
64
  worker_pids = File.read(PID_PATH).split(",").map(&:to_i)
@@ -68,7 +70,14 @@ module BlueGreenProcess
68
70
  worker_pids.each do |worker_pid|
69
71
  Process.kill "TERM", worker_pid
70
72
  rescue Errno::ESRCH => e
71
- warn("BlueGreenProcess workerプロセス(#{worker_pid})の終了に失敗しました。", e.message)
73
+ BlueGreenProcess.logger.warn("[BLUE_GREEN_PROCESS][#{$PROCESS_ID}] workerプロセス(#{worker_pid})の終了に失敗しました。#{e.message}")
74
+ end
75
+
76
+ begin
77
+ Process.wait
78
+ rescue Errno::ECHILD => e
79
+ BlueGreenProcess.logger.warn("[BLUE_GREEN_PROCESS][#{$PROCESS_ID}] Process.wait(#{e.message})に失敗しました")
72
80
  end
81
+ BlueGreenProcess.logger.warn "[BLUE_GREEN_PROCESS][#{$PROCESS_ID}] TERMシグナルを送信しました"
73
82
  end
74
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blue_green_process
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-12 00:00:00.000000000 Z
11
+ date: 2022-12-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A library that solves GC bottlenecks with multi-process.
14
14
  email: