worker_killer 1.0.0.39841 → 1.0.1.83603

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: 1872ba3735c3ca8fb1874b6a2bc807fae670d8ad1d1f4b62ae10817d4ebeedc3
4
- data.tar.gz: 776d62bdde47b1ba46b11eda4246e47d2b0420508fb457e6dda513263c49a9a3
3
+ metadata.gz: af1736e1bb8f2bfc3c3aa9e93d2fa1aa429173dc2389e7969c24210479e90441
4
+ data.tar.gz: f472d15158b29d0a920e49f873b46edcc19f554c0d3a75cfe33cf43b195ed0d6
5
5
  SHA512:
6
- metadata.gz: 5f4bb9e6f2955246fc4f320e5bf198d4d66b59500ba3644de205da0fd0767e354e2f8792984364922276ef8e0e0c5939de062ca5d53c0edf093c94d00a6f65ef
7
- data.tar.gz: b4e9fcdb8395aaacc81a510d83c0744a566d483f1a14fe66baf4422e14d6d60155c17d12a90c32f3d70fd798bff6d104782512a922ee78f7bf4ceb93c214ae78
6
+ metadata.gz: 2796b66e4f0069df66073c2acdc2cefa7c2213efdf36ddaf7a76e63cdc9bf53ffe4b369406bb8e6dd890d6f242b47f44fcd4cfde83e73b499f8d1e002097a8bd
7
+ data.tar.gz: a3d13754ae85c50564e8b825d61ec8d0397b1e664647e3b18a4423426f081b6a6bada3e26941773415856afa1e5abab8fdf04a88045beb2f2b704054f0d1517e
@@ -13,7 +13,7 @@ module WorkerKiller
13
13
  k.kill(l.started_at, dj: dj)
14
14
  end
15
15
 
16
- @limiter = klass.new(opts)
16
+ @limiter = klass.new(**opts)
17
17
  end
18
18
 
19
19
  def new(*_args)
@@ -14,7 +14,7 @@ module WorkerKiller
14
14
  k.kill(l.started_at)
15
15
  end
16
16
 
17
- @limiter = klass.new(opts)
17
+ @limiter = klass.new(**opts)
18
18
  end
19
19
 
20
20
  def call(env)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module WorkerKiller
4
4
 
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
 
7
7
  end
8
8
 
@@ -1,5 +1,5 @@
1
1
  RSpec.describe WorkerKiller::CountLimiter do
2
- subject{ described_class.new(options) }
2
+ subject{ described_class.new(**options) }
3
3
  let(:min){ rand(50..100) }
4
4
  let(:max){ min + rand(100) }
5
5
  let(:options){ { min: min, max: max, verbose: true } }
data/spec/killer_spec.rb CHANGED
@@ -19,9 +19,15 @@ RSpec.describe WorkerKiller::Killer::Base do
19
19
  end
20
20
 
21
21
  it 'expect right signal order' do
22
- expect(killer).to receive(:do_kill).with(:QUIT, anything, anything, anything).exactly(2).times
23
- expect(killer).to receive(:do_kill).with(:TERM, anything, anything, anything).exactly(2).times
24
- expect(killer).to receive(:do_kill).with(:KILL, anything, anything, anything).exactly(5).times
22
+ if RUBY_VERSION >= "3.0.0"
23
+ expect(killer).to receive(:do_kill).with(:QUIT, anything, anything).exactly(2).times
24
+ expect(killer).to receive(:do_kill).with(:TERM, anything, anything).exactly(2).times
25
+ expect(killer).to receive(:do_kill).with(:KILL, anything, anything).exactly(5).times
26
+ else
27
+ expect(killer).to receive(:do_kill).with(:QUIT, anything, anything, anything).exactly(2).times
28
+ expect(killer).to receive(:do_kill).with(:TERM, anything, anything, anything).exactly(2).times
29
+ expect(killer).to receive(:do_kill).with(:KILL, anything, anything, anything).exactly(5).times
30
+ end
25
31
 
26
32
  2.times { killer.kill(Time.now) } # 2 QUIT
27
33
  2.times { killer.kill(Time.now) } # 2 TERM
@@ -1,7 +1,7 @@
1
1
  RSpec.describe WorkerKiller::MemoryLimiter do
2
2
  let(:logger){ Logger.new(nil) }
3
3
 
4
- subject{ described_class.new(options) }
4
+ subject{ described_class.new(**options) }
5
5
  let(:mb){ 1024 * 1024 }
6
6
  let(:min){ rand(50..100) * mb }
7
7
  let(:max){ min + rand(100) * mb }
@@ -9,7 +9,7 @@ RSpec.describe WorkerKiller::Middleware do
9
9
  describe 'Custom class' do
10
10
  let(:klass){ double }
11
11
  let(:options){ { killer: killer, klass: klass, reaction: reaction, anykey: anykey } }
12
- subject{ described_class.new(app, options) }
12
+ subject{ described_class.new(app, **options) }
13
13
 
14
14
  it 'is expected to be initialized' do
15
15
  expect(klass).to receive(:new).with(anykey: anykey).and_return(99)
@@ -20,7 +20,7 @@ RSpec.describe WorkerKiller::Middleware do
20
20
 
21
21
  describe WorkerKiller::Middleware::RequestsLimiter do
22
22
  let(:options){ { killer: killer, min: 3, max: 3 } }
23
- subject{ described_class.new(app, options) }
23
+ subject{ described_class.new(app, **options) }
24
24
 
25
25
  it 'is expected to be initialized without reaction' do
26
26
  expect(WorkerKiller::CountLimiter).to receive(:new).with(min: 3, max: 3).and_call_original
@@ -51,7 +51,7 @@ RSpec.describe WorkerKiller::Middleware do
51
51
 
52
52
  describe WorkerKiller::Middleware::OOMLimiter do
53
53
  let(:options){ { killer: killer, min: 2222, max: 2223 } }
54
- subject{ described_class.new(app, options) }
54
+ subject{ described_class.new(app, **options) }
55
55
 
56
56
  it 'is expected to be initialized without reaction' do
57
57
  expect(WorkerKiller::MemoryLimiter).to receive(:new).with(min: 2222, max: 2223).and_call_original
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worker_killer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.39841
4
+ version: 1.0.1.83603
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samoilenko Yuri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-28 00:00:00.000000000 Z
11
+ date: 2022-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: get_process_mem
@@ -169,13 +169,13 @@ signing_key:
169
169
  specification_version: 4
170
170
  summary: Kill any workers by memory and request counts or take custom reaction
171
171
  test_files:
172
- - spec/middleware_spec.rb
173
- - spec/killer_spec.rb
174
- - spec/spec_helper.rb
175
- - spec/killer/passenger_spec.rb
176
172
  - spec/killer/signal_spec.rb
177
173
  - spec/killer/delayed_job_spec.rb
178
- - spec/memory_limiter_spec.rb
179
- - spec/support/logger.rb
180
- - spec/worker_killer_spec.rb
174
+ - spec/killer/passenger_spec.rb
175
+ - spec/killer_spec.rb
181
176
  - spec/count_limiter_spec.rb
177
+ - spec/worker_killer_spec.rb
178
+ - spec/support/logger.rb
179
+ - spec/middleware_spec.rb
180
+ - spec/spec_helper.rb
181
+ - spec/memory_limiter_spec.rb