diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/couch/src/couch_view.erl | 3 | ||||
-rw-r--r-- | apps/couch/src/couch_view_group.erl | 18 |
2 files changed, 8 insertions, 13 deletions
diff --git a/apps/couch/src/couch_view.erl b/apps/couch/src/couch_view.erl index 8615ea35..9de86b82 100644 --- a/apps/couch/src/couch_view.erl +++ b/apps/couch/src/couch_view.erl @@ -44,8 +44,7 @@ get_temp_updater(DbName, Language, DesignOptions, MapSrc, RedSrc) -> get_group_server(DbName, GroupId) -> % get signature for group case couch_view_group:open_db_group(DbName, GroupId) of - % do we need to close this db? - {ok, _Db, Group} -> + {ok, Group} -> case gen_server:call(couch_view, {get_group_server, DbName, Group}) of {ok, Pid} -> Pid; diff --git a/apps/couch/src/couch_view_group.erl b/apps/couch/src/couch_view_group.erl index 8b79af63..377e7516 100644 --- a/apps/couch/src/couch_view_group.erl +++ b/apps/couch/src/couch_view_group.erl @@ -440,17 +440,13 @@ set_view_sig(#group{ G#group{sig=couch_util:md5(term_to_binary({Views, Language, DesignOptions}))}. open_db_group(DbName, GroupId) -> - case couch_db:open_int(DbName, []) of - {ok, Db} -> - case couch_db:open_doc(Db, GroupId) of - {ok, Doc} -> - {ok, Db, design_doc_to_view_group(Doc)}; - Else -> - couch_db:close(Db), - Else - end; - Else -> - Else + {Pid, Ref} = spawn_monitor(fun() -> + exit(fabric:open_doc(mem3:dbname(DbName), GroupId, [])) + end), + receive {'DOWN', Ref, process, Pid, {ok, Doc}} -> + {ok, design_doc_to_view_group(Doc)}; + {'DOWN', Ref, process, Pid, Error} -> + Error end. get_group_info(State) -> |