couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1002817 - /couchdb/branches/new_replicator/src/couchdb/couch_replicator_utils.erl
Date Wed, 29 Sep 2010 19:26:51 GMT
Author: fdmanana
Date: Wed Sep 29 19:26:51 2010
New Revision: 1002817

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

Modified:
    couchdb/branches/new_replicator/src/couchdb/couch_replicator_utils.erl

Modified: couchdb/branches/new_replicator/src/couchdb/couch_replicator_utils.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_replicator_utils.erl?rev=1002817&r1=1002816&r2=1002817&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_replicator_utils.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_replicator_utils.erl Wed Sep 29 19:26:51
2010
@@ -62,10 +62,15 @@ filter_code(Filter, Source, UserCtx) ->
     {match, [DDocName, FilterName]} =
         re:run(Filter, "(.*?)/(.*)", [{capture, [1, 2], binary}]),
     {ok, Db} = couch_api_wrap:db_open(Source, [{user_ctx, UserCtx}]),
-    {ok, #doc{body = Body}} =
-        couch_api_wrap:open_doc(Db, <<"_design/", DDocName/binary>>, []),
-    Code = couch_util:get_nested_json_value(Body, [<<"filters">>, FilterName]),
-    re:replace(Code, "^\s*(.*?)\s*$", "\\1", [{return, binary}]).
+    try
+        {ok, #doc{body = Body}} =
+            couch_api_wrap:open_doc(Db, <<"_design/", DDocName/binary>>, []),
+        Code = couch_util:get_nested_json_value(
+            Body, [<<"filters">>, FilterName]),
+        re:replace(Code, "^\s*(.*?)\s*$", "\\1", [{return, binary}])
+    after
+        couch_api_wrap:db_close(Db)
+    end.
 
 
 maybe_append_options(Options, RepOptions) ->



Mime
View raw message