couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1002810 - /couchdb/trunk/src/couchdb/couch_rep.erl
Date Wed, 29 Sep 2010 19:13:13 GMT
Author: fdmanana
Date: Wed Sep 29 19:13:13 2010
New Revision: 1002810

URL: http://svn.apache.org/viewvc?rev=1002810&view=rev
Log:
Add missing expression to close the database (COUCHDB-892 related).

Modified:
    couchdb/trunk/src/couchdb/couch_rep.erl

Modified: couchdb/trunk/src/couchdb/couch_rep.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep.erl?rev=1002810&r1=1002809&r2=1002810&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep.erl Wed Sep 29 19:13:13 2010
@@ -514,9 +514,14 @@ filter_code(Filter, Props, UserCtx) ->
         re:run(Filter, "(.*?)/(.*)", [{capture, [1, 2], binary}]),
     ProxyParams = parse_proxy_params(?getv(<<"proxy">>, Props, [])),
     Source = open_db(?getv(<<"source">>, Props), UserCtx, ProxyParams),
-    {ok, #doc{body = Body}} = open_doc(Source, <<"_design/", DDocName/binary>>),
-    Code = couch_util:get_nested_json_value(Body, [<<"filters">>, FilterName]),
-    re:replace(Code, "^\s*(.*?)\s*$", "\\1", [{return, binary}]).
+    try
+        {ok, DDoc} = open_doc(Source, <<"_design/", DDocName/binary>>),
+        Code = couch_util:get_nested_json_value(
+            DDoc#doc.body, [<<"filters">>, FilterName]),
+        re:replace(Code, "^\s*(.*?)\s*$", "\\1", [{return, binary}])
+    after
+        close_db(Source)
+    end.
 
 maybe_add_trailing_slash(Url) ->
     re:replace(Url, "[^/]$", "&/", [{return, list}]).



Mime
View raw message