sponges 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sponges/supervisor.rb +11 -3
- data/lib/sponges/version.rb +1 -1
- metadata +2 -2
data/lib/sponges/supervisor.rb
CHANGED
@@ -4,9 +4,7 @@ module Sponges
|
|
4
4
|
def initialize(name, options, worker, method, *args, &block)
|
5
5
|
@name, @options = name, options
|
6
6
|
@worker, @method, @args, @block = worker, method, args, block
|
7
|
-
|
8
|
-
@redis[:workers].sadd name
|
9
|
-
@redis[:worker][@name][:supervisor].set Process.pid
|
7
|
+
set_up_redis
|
10
8
|
@pids = @redis[:worker][name][:pids]
|
11
9
|
@children_seen = 0
|
12
10
|
end
|
@@ -25,6 +23,16 @@ module Sponges
|
|
25
23
|
|
26
24
|
private
|
27
25
|
|
26
|
+
def set_up_redis
|
27
|
+
if Configuration.redis
|
28
|
+
redis_client = Configuration.redis
|
29
|
+
redis_client.client.reconnect
|
30
|
+
end
|
31
|
+
@redis = Nest.new('sponges', redis_client || Redis.new)[Socket.gethostname]
|
32
|
+
@redis[:workers].sadd @name
|
33
|
+
@redis[:worker][@name][:supervisor].set Process.pid
|
34
|
+
end
|
35
|
+
|
28
36
|
def fork_children
|
29
37
|
name = children_name
|
30
38
|
pid = fork do
|
data/lib/sponges/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sponges
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: boson
|