pyramid_scheme 0.1.4 → 0.1.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 +1 -1
- data/lib/pyramid_scheme/index_client.rb +6 -2
- data/pyramid_scheme.gemspec +1 -1
- data/spec/pyramid_scheme/index_client_spec.rb +6 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.5
|
@@ -12,12 +12,16 @@ module PyramidScheme
|
|
12
12
|
|
13
13
|
def searchd_pids
|
14
14
|
ps_output = `ps ax | grep searchd`
|
15
|
-
ps_output.split("\n").collect{|p|
|
15
|
+
ps_output.split("\n").collect{|p| /^\s*(\d*)/.match(p)[1]}
|
16
16
|
end
|
17
17
|
|
18
18
|
def bounce_pids
|
19
19
|
searchd_pids.each do |pid|
|
20
|
-
|
20
|
+
begin
|
21
|
+
Process.kill("HUP", pid.to_i) if pid != ""
|
22
|
+
rescue Exception => e
|
23
|
+
raise e unless e.message =~ /No such process/i
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
23
27
|
|
data/pyramid_scheme.gemspec
CHANGED
@@ -14,6 +14,12 @@ describe PyramidScheme::IndexClient do
|
|
14
14
|
Process.expects(:kill).with("HUP", 4345)
|
15
15
|
@client.bounce_pids
|
16
16
|
end
|
17
|
+
|
18
|
+
it 'should continue gracefully if no such process gets raise' do
|
19
|
+
@client.expects(:searchd_pids).returns(["4345"])
|
20
|
+
Process.expects(:kill).raises(Exception, "No Such Process").then.returns(1)
|
21
|
+
lambda { @client.bounce_pids }.should_not raise_error
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
|