Skip to content

Commit

Permalink
Merge branch 'trunk' into geocouch
Browse files Browse the repository at this point in the history
  • Loading branch information
vmx committed Aug 19, 2010
2 parents c2f2ed0 + 83f5171 commit 965ecc4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
11 changes: 11 additions & 0 deletions share/www/script/test/view_update_seq.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ couchTests.view_update_seq = function(debug) {
T(resp.rows.length == 1);
T(resp.update_seq == 101);

// wait 5 seconds for the next assertions to pass in very slow machines
var t0 = new Date(), t1;
do {
CouchDB.request("GET", "/");
t1 = new Date();
} while ((t1 - t0) < 5000);

resp = db.view('test/all_docs', {limit: 1, stale: "ok", update_seq: true});
T(resp.rows.length == 1);
T(resp.update_seq == 103);

resp = db.view('test/all_docs', {limit: 1, update_seq:true});
T(resp.rows.length == 1);
T(resp.update_seq == 103);
Expand Down
7 changes: 3 additions & 4 deletions src/couchdb/couch_view.erl
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ get_group(Db, GroupId, Stale) ->
update_after -> 0;
_Else -> couch_db:get_update_seq(Db)
end,
Result = {ok, Group} = couch_view_group:request_group(
get_group_server(couch_db:name(Db), GroupId),
MinUpdateSeq),
GroupPid = get_group_server(couch_db:name(Db), GroupId),
Result = couch_view_group:request_group(GroupPid, 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)
couch_view_group:request_group(GroupPid, LastSeq)
end);
_ ->
ok
Expand Down

0 comments on commit 965ecc4

Please sign in to comment.