summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/couch_views/src/couch_views_indexer.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/couch_views/src/couch_views_indexer.erl b/src/couch_views/src/couch_views_indexer.erl
index e3b2ad5bc..8019d9f6a 100644
--- a/src/couch_views/src/couch_views_indexer.erl
+++ b/src/couch_views/src/couch_views_indexer.erl
@@ -182,17 +182,19 @@ add_error(Error, Reason, Data) ->
update(#{} = Db, Mrst0, State0) ->
Limit = couch_views_batch:start(Mrst0),
- {Mrst1, State1} = try
+ Result = try
do_update(Db, Mrst0, State0#{limit => Limit})
catch
error:{erlfdb_error, Error} when ?IS_RECOVERABLE_ERROR(Error) ->
couch_views_batch:failure(Mrst0),
update(Db, Mrst0, State0)
end,
- case State1 of
- finished ->
+ case Result of
+ ok ->
+ ok; % Already finished and released map context
+ {Mrst1, finished} ->
couch_eval:release_map_context(Mrst1#mrst.qserver);
- _ ->
+ {Mrst1, State1} ->
#{
update_stats := UpdateStats
} = State1,