Commits

Adam Kocoloski  committed 0fdd48e

bugfix for _changes when DB is deleted mid-response

  • Participants
  • Parent commits c689613

Comments (0)

Files changed (1)

File src/couchdb/couch_httpd_db.erl

     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