Sha256: 1206f7f56199b588efb9dc14c2d5c2c747225dcb5f07381a7e4ee20bba4e328f
Contents?: true
Size: 1.01 KB
Versions: 4
Compression:
Stored size: 1.01 KB
Contents
# encoding: UTF-8 # -- # Copyright (C) 2008-2011 10gen Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ++ module Mongo #:nodoc: module TimeoutWrapper extend self def timeout_lib=(lib) @@timeout_lib = lib end def timeout_lib @@timeout_lib end def timeout(delay, &block) if timeout_lib begin timeout_lib.timeout(delay, &block) rescue ::Timeout::Error raise Mongo::OperationTimeout end else yield end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
mongo-1.5.1 | lib/mongo/util/timeout.rb |
mongo-1.5.0.rc0 | lib/mongo/util/timeout.rb |
mongo-1.4.0 | lib/mongo/util/timeout.rb |
mongo-1.3.0.rc0 | lib/mongo/util/timeout.rb |