summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2009-09-21 20:18:41 +0000
committerAdam Kocoloski <kocolosk@apache.org>2009-09-21 20:18:41 +0000
commitec9ad52b8444317ededce3a5f2dc4ae63c89d763 (patch)
tree3b296e1bb605085dd211b79b2f707665abcfee14
parent5c3a18b7b202b39481e3ff69cac846db3190b653 (diff)
bugfix for _changes when DB is deleted mid-response
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@817398 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/couchdb/couch_httpd_db.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index cdc74610..32fc1b11 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -155,9 +155,13 @@ keep_sending_changes(#httpd{user_ctx=UserCtx,path_parts=[DbName|_]}=Req, Resp,
true ->
case wait_db_updated(Timeout, TimeoutFun) of
updated ->
- {ok, Db2} = couch_db:open(DbName, [{user_ctx, UserCtx}]),
- keep_sending_changes(Req, Resp, Db2, EndSeq, Prepend2, Timeout,
- TimeoutFun, ResponseType, NewLimit, Filter, End);
+ case couch_db:open(DbName, [{user_ctx, UserCtx}]) of
+ {ok, Db2} ->
+ keep_sending_changes(Req, Resp, Db2, EndSeq, Prepend2, Timeout,
+ TimeoutFun, ResponseType, NewLimit, Filter, End);
+ _Else ->
+ end_sending_changes(Resp, EndSeq, ResponseType)
+ end;
stop ->
end_sending_changes(Resp, EndSeq, ResponseType)
end