sponges 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- @redis = Nest.new('sponges', Configuration.redis || Redis.new)[Socket.gethostname]
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
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Sponges
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
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.3
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-11 00:00:00.000000000 Z
12
+ date: 2012-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: boson