royw-drbman 0.0.4 → 0.0.5

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/drbman.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{drbman}
5
- s.version = "0.0.4"
5
+ s.version = "0.0.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Roy Wright"]
@@ -4,6 +4,17 @@ require 'primes'
4
4
  # Note, these assume you have an ssh public key set up for
5
5
  # this box (i.e: it does an "ssh localhost").
6
6
 
7
+ def env_ok
8
+ result = !(ENV['TEST_HOST'].nil? || ENV['TEST_USER'].nil? || ENV['TEST_PASSWORD'].nil?)
9
+ unless result
10
+ puts
11
+ puts "You need to setup the following environment variables: TEST_HOST, TEST_USER, TEST_PASSWORD"
12
+ puts "Alternatively run spec like: TEST_HOST='box' TEST_USER='who' TEST_PASSWORD='sekret' spec spec/primes_spec.rb"
13
+ puts
14
+ end
15
+ result
16
+ end
17
+
7
18
  describe('SieveOfEratosthenes') do
8
19
  before(:each) do
9
20
  @choices = {}
@@ -81,13 +92,3 @@ describe('SieveOfEratosthenes') do
81
92
 
82
93
  end
83
94
 
84
- def env_ok
85
- result = !(ENV['TEST_HOST'].nil? || ENV['TEST_USER'].nil? || ENV['TEST_PASSWORD'].nil?)
86
- unless result
87
- puts
88
- puts "You need to setup the following environment variables: TEST_HOST, TEST_USER, TEST_PASSWORD"
89
- puts "Alternatively run spec like: TEST_HOST='box' TEST_USER='who' TEST_PASSWORD='sekret' spec spec/primes_spec.rb"
90
- puts
91
- end
92
- result
93
- end
@@ -74,8 +74,18 @@ class DrbPool
74
74
  def next_object(mutex)
75
75
  object = nil
76
76
  mutex.synchronize do
77
- object = @objects.select {|obj| !obj.in_use?}.first
78
- object.in_use = true unless object.nil?
77
+ @objects.select {|obj| !obj.in_use?}.each do |obj|
78
+ unless obj.nil?
79
+ begin
80
+ obj.name # make sure we can still talk with drb server
81
+ obj.in_use = true
82
+ object = obj
83
+ break
84
+ rescue
85
+ object = nil
86
+ end
87
+ end
88
+ end
79
89
  end
80
90
  object
81
91
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: royw-drbman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roy Wright