summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-12-31 16:38:28 -0500
committerAdam Kocoloski <adam@cloudant.com>2011-01-02 20:30:00 -0500
commit11af04ba67499a5aa3e85076b223c5ae8a9b500b (patch)
treec137f9b38c1c5a596050bd357b334aad919dc303
parentfd1496ac700452ff79c5d5a6a893dcb8d32ce263 (diff)
Allow client to specify a timeout when opening a DB
-rw-r--r--apps/couch/src/couch_server.erl3
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/couch/src/couch_server.erl b/apps/couch/src/couch_server.erl
index a08da475..0624e71f 100644
--- a/apps/couch/src/couch_server.erl
+++ b/apps/couch/src/couch_server.erl
@@ -50,7 +50,8 @@ open(DbName, Options) ->
ets:insert(couch_lru, {DbName, now()}),
{ok, Db#db{user_ctx=Ctx, fd_monitor=erlang:monitor(process,Fd)}};
_ ->
- case gen_server:call(couch_server, {open, DbName, Options}, infinity) of
+ Timeout = couch_util:get_value(timeout, Options, infinity),
+ case gen_server:call(couch_server, {open, DbName, Options}, Timeout) of
{ok, #db{fd=Fd} = Db} ->
ets:insert(couch_lru, {DbName, now()}),
{ok, Db#db{user_ctx=Ctx, fd_monitor=erlang:monitor(process,Fd)}};