summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2011-03-11 11:22:14 -0500
committerAdam Kocoloski <adam@cloudant.com>2011-03-14 23:19:23 -0400
commitf9dd93d1f51f1e53900e97d99312968c37323e0c (patch)
tree0cd5c0ae778f6d2fcc290b1dc36684a0e962545f /apps
parent13651123de6f3b361ac6db0c65d8ed10fea11915 (diff)
Fall back to local DB in open_db_group/2
Diffstat (limited to 'apps')
-rw-r--r--apps/couch/src/couch_view_group.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/couch/src/couch_view_group.erl b/apps/couch/src/couch_view_group.erl
index 730db185..b0e67db5 100644
--- a/apps/couch/src/couch_view_group.erl
+++ b/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)};