sponges 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/sponges.rb +13 -22
- data/lib/sponges/configuration.rb +1 -1
- data/lib/sponges/store.rb +2 -2
- data/lib/sponges/supervisor.rb +2 -2
- data/lib/sponges/version.rb +1 -1
- 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: f551ee294a287cee6d1203194614d8b248502a6e
|
4
|
+
data.tar.gz: e83629c13573a38f4629fe65d6b48fe050d7c661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e3f1989505d429e94d865711cfc1182bf5bf480f182b599d941cd9419d4875840134d0529e353dadf00d26bf0be54cf1278f0b98987c6416b2ea645ea521fe7
|
7
|
+
data.tar.gz: ceda65d4e04987e49e1640d8a7750a9e335778dc5824c38920fcfc6e9cdd0ab8a2d1bd0d28cc68c3e45e4fac81d31716b39d79941491f2aeeb090865ad274377
|
data/README.md
CHANGED
@@ -72,6 +72,7 @@ Sponges.configure do |config|
|
|
72
72
|
config.size = 3 # optionnal, default to cpu's size
|
73
73
|
config.daemonize = true # optionnal, default to false
|
74
74
|
config.port = 5032 # optionnal, default to 5032
|
75
|
+
config.env = :production # optionnal, default to nil
|
75
76
|
# polling on supervisor, this is use to shutdown children in case supervisor
|
76
77
|
# receive a `SIGKILL` signal.
|
77
78
|
config.polling = 60 # optionnal, default to 60
|
data/lib/sponges.rb
CHANGED
@@ -1,43 +1,34 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
require_relative 'sponges/version'
|
10
|
-
require_relative 'sponges/alive'
|
11
|
-
require_relative 'sponges/configuration'
|
12
|
-
require_relative 'sponges/worker'
|
13
|
-
require_relative 'sponges/handler'
|
14
|
-
require_relative 'sponges/response'
|
15
|
-
require_relative 'sponges/listener'
|
16
|
-
require_relative 'sponges/supervisor'
|
17
|
-
require_relative 'sponges/runner'
|
18
|
-
require_relative 'sponges/commander'
|
19
|
-
require_relative 'sponges/cli'
|
20
|
-
require_relative 'sponges/store'
|
2
|
+
%w[boson/runner socket logger machine forwardable json].each do |lib|
|
3
|
+
require lib
|
4
|
+
end
|
5
|
+
%w[version alive configuration worker handler response listener supervisor
|
6
|
+
runner commander cli store].each do |lib|
|
7
|
+
require_relative "sponges/#{lib}"
|
8
|
+
end
|
21
9
|
|
22
10
|
module Sponges
|
23
11
|
STOP_SIGNALS = [:INT, :QUIT, :TERM]
|
24
12
|
SIGNALS = STOP_SIGNALS + [:HUP, :TTIN, :TTOU, :CHLD]
|
25
13
|
|
14
|
+
module_function
|
15
|
+
|
26
16
|
def configure(&block)
|
27
17
|
Sponges::Configuration.configure &block
|
28
18
|
end
|
29
|
-
module_function :configure
|
30
19
|
|
31
20
|
def start(worker_name, options = {}, argv = ARGV, &block)
|
32
21
|
Sponges::Configuration.worker_name = worker_name
|
33
22
|
Sponges::Configuration.worker = block
|
34
23
|
Sponges::Cli.start(argv)
|
35
24
|
end
|
36
|
-
module_function :start
|
37
25
|
|
38
26
|
def logger
|
39
27
|
return @logger if @logger
|
40
28
|
@logger = Sponges::Configuration.logger || Logger.new(STDOUT)
|
41
29
|
end
|
42
|
-
|
30
|
+
|
31
|
+
def env
|
32
|
+
Sponges::Configuration.env
|
33
|
+
end
|
43
34
|
end
|
data/lib/sponges/store.rb
CHANGED
@@ -38,11 +38,11 @@ module Sponges
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def supervisor_name
|
41
|
-
|
41
|
+
[name, Sponges.env, "supervisor"].compact.join("_")
|
42
42
|
end
|
43
43
|
|
44
44
|
def childs_name
|
45
|
-
|
45
|
+
[name, Sponges.env, "child"].compact.join("_")
|
46
46
|
end
|
47
47
|
|
48
48
|
def find_supervisor
|
data/lib/sponges/supervisor.rb
CHANGED
@@ -8,7 +8,7 @@ module Sponges
|
|
8
8
|
|
9
9
|
def initialize(name, options, store, block)
|
10
10
|
@name, @options, @store, @block = name, options, store, block
|
11
|
-
$PROGRAM_NAME =
|
11
|
+
$PROGRAM_NAME = [@name, Sponges.env, "supervisor"].compact.join("_")
|
12
12
|
store.register Process.pid
|
13
13
|
@children_seen = 0
|
14
14
|
@handler = Handler.new self
|
@@ -38,7 +38,7 @@ module Sponges
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def children_name
|
41
|
-
"#{
|
41
|
+
[name, Sponges.env, "child_#{@children_seen +=1}"].compact.join("_")
|
42
42
|
end
|
43
43
|
|
44
44
|
def trap_signals
|
data/lib/sponges/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sponges
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- chatgris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: boson
|