public
Rubygem
Description: Don't mind this, go to http://github.com/integrity/integrity
Homepage: http://integrityapp.com
Clone URL: git://github.com/foca/integrity.git
protection against eventual notifiers timeout error
sr (author)
Thu Nov 20 11:36:02 -0800 2008
commit  c969e8cae2aecd82a281016e02c2ef61b2a9b673
tree    99b96def3454bc453bcf960a17ee0735508f5ef6
parent  a10e36aafacd17430bd62ab67a938ac48383fbed
...
12
13
14
 
15
16
17
...
12
13
14
15
16
17
18
0
@@ -12,6 +12,7 @@ require 'dm-aggregates'
0
 require 'yaml'
0
 require 'logger'
0
 require 'digest/sha1'
0
+require 'timeout'
0
 
0
 require "core_ext/object"
0
 require "core_ext/string"
...
2
3
4
5
 
 
 
6
7
8
...
2
3
4
 
5
6
7
8
9
10
0
@@ -2,7 +2,9 @@ module Integrity
0
   class Notifier
0
     class Base
0
       def self.notify_of_build(build, config)
0
-        new(build, config).deliver!
0
+        Timeout.timeout(6) do
0
+          new(build, config).deliver!
0
+        end
0
       end
0
 
0
       def self.to_haml
...
32
33
34
 
 
 
 
 
 
35
36
37
...
32
33
34
35
36
37
38
39
40
41
42
43
0
@@ -32,6 +32,12 @@ describe Integrity::Notifier::Base do
0
       notifier.should_receive(:deliver!)
0
       klass.notify_of_build(mock_build, notifier_config)
0
     end
0
+
0
+    it "should protect itself from timeout" do
0
+      lambda do
0
+        notifier.stub!(:deliver!).and_raise(Timeout::Error)
0
+      end.should_not raise_error
0
+    end
0
   end
0
   
0
   describe "generating the config form" do

Comments