Permalink
Browse files

timeout connects after 2 seconds

  • Loading branch information...
1 parent 091664f commit 4772b315776b7fd8c11634e27e3b7e38b35bb55c @tmm1 committed Aug 2, 2008
Showing with 5 additions and 0 deletions.
  1. +5 −0 rmongo.rb
View
@@ -3,6 +3,7 @@
require 'buffer'
module Mongo
+ class Error < Exception; end
module Client
include EM::Deferrable
@@ -11,6 +12,10 @@ def initialize opts = {}
@settings = opts
@id = 0
@namespace = 'default.test'
+ timeout 2
+ errback{
+ raise Error, 'could not connect to server'
+ }
end
attr_accessor :namespace

0 comments on commit 4772b31

Please sign in to comment.