stalin 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/stalin/adapter/puma.rb +13 -9
- data/stalin.gemspec +4 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3aba1948f1211ea981734cb7eb62d1326536b0b
|
4
|
+
data.tar.gz: 694df9a4c8732561d328a26ce17f64fa12eec669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b922bd545a388a1457220caa2fe3d308d82401b59a25e01b667db3810263a8019fb304a80c3031cb66a298928e57b33aa07c2d147ce64cfc77d5cb668d9085b
|
7
|
+
data.tar.gz: fc6067a0ada40c95060d978c6615b9d0054ea2abc37a0062a54b91be2367f3ac6bae06c073166b1c2715f59e8e0200ab23b03d30836bb35170b04e3461791b0a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/stalin/adapter/puma.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Stalin::Adapter
|
2
|
-
# A Stalin adapter that is suitable for use in Puma worker processes. Puma
|
3
|
-
#
|
2
|
+
# A Stalin adapter that is suitable for use in Puma worker processes. Puma has two
|
3
|
+
# execution models.
|
4
|
+
# - "Cluster" spawns N worker processes; each responds to SIGTERM with graceful shutdown and SIGQUIT with abrupt shutdown
|
5
|
+
# - "Single" runs a server in the one-and-only master process; it responds to SIGUSR2 with graceflu restart
|
4
6
|
class Puma < Rack
|
5
7
|
# Create a middleware instance.
|
6
8
|
#
|
@@ -10,17 +12,19 @@ module Stalin::Adapter
|
|
10
12
|
# @param [Integer] cycle how frequently to check memory consumption (# requests)
|
11
13
|
# @param [Boolean] verbose log extra information
|
12
14
|
def initialize(app, min=1024**3, max=2*1024**3, cycle=16, verbose=false)
|
15
|
+
# Puma has no singletons, so we need to grab a reference to its CLI object.
|
16
|
+
# The CLI will not exist if puma was invoked through rackup.
|
17
|
+
#
|
18
|
+
# Since the master forks its workers, the CLI object also exists in workers.
|
19
|
+
# By the time this code runs, we'll always be in a worker.
|
13
20
|
cli = nil
|
14
|
-
ObjectSpace.each_object(::Puma::CLI) { |o| cli = o }
|
21
|
+
ObjectSpace.each_object(::Puma::CLI) { |o| cli = o } if defined?(::Puma::CLI)
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
if cli.clustered? && cli.options[:workers] > 0
|
19
|
-
# We're clustered, so workers can SIGTERM themselves to cause a restart
|
23
|
+
if cli && cli.clustered? && cli.options[:workers] > 0
|
24
|
+
# Multiprocess model: send ourselves SIGTERM
|
20
25
|
super(app, :TERM, :QUIT, min, max, cycle, verbose)
|
21
26
|
else
|
22
|
-
#
|
23
|
-
# itself
|
27
|
+
# Single-process model ("rackup," or "puma -w 0")
|
24
28
|
super(app, :USR2, :USR1, min, max, cycle, verbose)
|
25
29
|
end
|
26
30
|
end
|
data/stalin.gemspec
CHANGED
@@ -2,16 +2,14 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: stalin 0.1.0 ruby lib
|
6
5
|
|
7
6
|
Gem::Specification.new do |s|
|
8
7
|
s.name = "stalin"
|
9
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
10
9
|
|
11
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
-
s.require_paths = ["lib"]
|
13
11
|
s.authors = ["Tony Spataro"]
|
14
|
-
s.date = "2015-04-
|
12
|
+
s.date = "2015-04-21"
|
15
13
|
s.description = "Kill Web application workers based on arbitrary conditions."
|
16
14
|
s.email = "xeger@xeger.net"
|
17
15
|
s.extra_rdoc_files = [
|
@@ -38,7 +36,8 @@ Gem::Specification.new do |s|
|
|
38
36
|
]
|
39
37
|
s.homepage = "https://github.com/xeger/stalin"
|
40
38
|
s.licenses = ["MIT"]
|
41
|
-
s.
|
39
|
+
s.require_paths = ["lib"]
|
40
|
+
s.rubygems_version = "2.0.14"
|
42
41
|
s.summary = "Kill rack"
|
43
42
|
|
44
43
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stalin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Spataro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jeweler
|