Permalink
Browse files

Fall back to local DB in open_db_group/2

  • Loading branch information...
1 parent 1365112 commit f9dd93d1f51f1e53900e97d99312968c37323e0c @kocolosk kocolosk committed Mar 11, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 apps/couch/src/couch_view_group.erl
@@ -441,7 +441,12 @@ set_view_sig(#group{
open_db_group(DbName, GroupId) ->
{Pid, Ref} = spawn_monitor(fun() ->
- exit(fabric:open_doc(mem3:dbname(DbName), GroupId, []))
+ exit(try
+ fabric:open_doc(mem3:dbname(DbName), GroupId, [])
+ catch error:database_does_not_exist ->
+ {ok, Db} = couch_db:open(DbName, []),
+ couch_db:open_doc(Db, GroupId)
+ end)
end),
receive {'DOWN', Ref, process, Pid, {ok, Doc}} ->
{ok, design_doc_to_view_group(Doc)};

0 comments on commit f9dd93d

Please sign in to comment.