diff options
author | Filipe David Borba Manana <fdmanana@apache.org> | 2010-08-02 17:33:59 +0000 |
---|---|---|
committer | Filipe David Borba Manana <fdmanana@apache.org> | 2010-08-02 17:33:59 +0000 |
commit | 495c20b9856b2abcbdc5a4620d6b4304dcafd70d (patch) | |
tree | 72af504ca756ed42c1bda6cb07127ce533037584 /src/couchdb/couch_view.erl | |
parent | d2a2a95aa75636493ed90a43f714768f6a2057bf (diff) |
Add option "stale=update_after" when querying a view. Closes COUCHDB-837.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@981607 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_view.erl')
-rw-r--r-- | src/couchdb/couch_view.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/couchdb/couch_view.erl b/src/couchdb/couch_view.erl index 38c0a783..189bd98f 100644 --- a/src/couchdb/couch_view.erl +++ b/src/couchdb/couch_view.erl @@ -58,11 +58,23 @@ get_group_server(DbName, GroupId) -> get_group(Db, GroupId, Stale) -> MinUpdateSeq = case Stale of ok -> 0; + update_after -> 0; _Else -> couch_db:get_update_seq(Db) end, - couch_view_group:request_group( + Result = {ok, Group} = couch_view_group:request_group( get_group_server(couch_db:name(Db), GroupId), - MinUpdateSeq). + MinUpdateSeq), + case Stale of + update_after -> + % best effort, process might die + spawn(fun() -> + LastSeq = couch_db:get_update_seq(Db), + couch_view_group:request_group(Group, LastSeq) + end); + _ -> + ok + end, + Result. get_temp_group(Db, Language, DesignOptions, MapSrc, RedSrc) -> couch_view_group:request_group( |