worker_killer 0.1.0.30337 → 0.1.1.30345

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: f82e8e7af98e4d6412f25fba67ce6557012f4837173ac2447d1c87fdabe8fef1
4
- data.tar.gz: 4a7d13da9e325d0514fbc4fe75dc15890ea82cef14ff847c8c60dbb859c63b91
3
+ metadata.gz: e6559ab7080c973e8a1410b166af0c1385054f5c8aa06af967525808c8319fe1
4
+ data.tar.gz: f163be90a2c2de875e85b8c4db2c543d28495a6a8a38cff2a093cac0d9a3b13a
5
5
  SHA512:
6
- metadata.gz: 4b4a853921c5fc93a16a686c8572e427cf6faa2436b670af01d01ee18e707c3974a43625ac8e393accf0be63195f8101054d6f012f25b0bde9dc8c0c974b37fc
7
- data.tar.gz: 2c0febe3c7176a32d6b83d3654c5a098531ebc74a4bb725ce0beebfc2fb3c78bb9def46c2515ca20510b8656448c965b6ce81beb1d377c2ddf6f138cd88484ea
6
+ metadata.gz: 851c5269665b10c65ee6838dbf4033f100a026c907b7d7fb72080df341851d3d8227eb192eecaa9b1417226ca9a3349dbd7e1ca54a45feea850f9fc932926990
7
+ data.tar.gz: b5fd359caeddabdea93b5beaff3fcf8887ef467cbda2732a141082c9c4244573329137fac8273e7565e6cbeee2562fa4b0b8496fdf64ab53d84d4a97f688d825
data/README.md CHANGED
@@ -9,13 +9,14 @@
9
9
  [![Outdated](https://lysander.x.rnds.pro/api/v1/badges/wkiller_outdated.svg)](https://lysander.x.rnds.pro/api/v1/badges/wkiller_outdated.html)
10
10
  [![Vulnerabilities](https://lysander.x.rnds.pro/api/v1/badges/wkiller_vulnerable.svg)](https://lysander.x.rnds.pro/api/v1/badges/wkiller_vulnerable.html)
11
11
 
12
- Kill any workers by memory and request counts or take custom reaction. Inspired by [unicorn-worker-killer](https://github.com/kzk/unicorn-worker-killer).
12
+ Kill any workers by memory and/or request counts or take custom reaction. Inspired by [unicorn-worker-killer](https://github.com/kzk/unicorn-worker-killer).
13
13
 
14
14
  `worker-killer` gem provides automatic restart of Web-server based on 1) max number of requests, and 2) process memory size (RSS). This will greatly improves site's stability by avoiding unexpected memory exhaustion at the application nodes.
15
15
 
16
16
  Features:
17
17
 
18
18
  * generic middleware implementation
19
+ * Phusion Passenger support(through `passenger-config detach-process <PID>`)
19
20
  * custom reaction hook
20
21
 
21
22
  Planned:
@@ -48,7 +49,7 @@ This gem provides two modules: WorkerKiller::CountLimiter and WorkerKiller::Memo
48
49
 
49
50
  ### WorkerKiller::Middleware::RequestsLimiter
50
51
 
51
- This module automatically restarts the kill workers, based on the number of requests which worker processed.
52
+ This module automatically restarts/kills the workers, based on the number of requests which worker processed.
52
53
 
53
54
  `min` and `max` specify the min and max of maximum requests per worker. The actual limit is decided by rand() between `min` and `max` per worker, to prevent all workers to be dead at the same time. Once the number exceeds the limit, that worker is automatically restarted.
54
55
 
@@ -56,7 +57,7 @@ If `verbose` is set to true, then after every request, your log will show the re
56
57
 
57
58
  ### WorkerKiller::Middleware::OOMLimiter
58
59
 
59
- This module automatically restarts the Unicorn workers, based on its memory size.
60
+ This module automatically restarts/kills the workers, based on its memory size.
60
61
 
61
62
  `min` and `max` specify the min and max of maximum memory in bytes per worker. The actual limit is decided by rand() between `min` and `max` per worker, to prevent all workers to be dead at the same time. Once the memory size exceeds `memory_size`, that worker is automatically restarted.
62
63
 
data/lib/worker_killer.rb CHANGED
@@ -55,6 +55,9 @@ module WorkerKiller
55
55
  end
56
56
 
57
57
  def self.kill_by_passenger(logger, alive_sec, passenger, pid)
58
+ return if @already_detached
59
+ @already_detached = true
60
+
58
61
  cmd = "#{passenger} detach-process #{pid}"
59
62
  logger.warn "#{self} run #{cmd.inspect} (pid: #{pid}) alive: #{alive_sec} sec (trial #{@kill_attempts})"
60
63
  Thread.new(cmd) do |command|
@@ -2,7 +2,7 @@
2
2
 
3
3
  module WorkerKiller
4
4
 
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
 
7
7
  end
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worker_killer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.30337
4
+ version: 0.1.1.30345
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samoilenko Yuri