You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2019/09/09 15:27:17 UTC
[couchdb] branch prototype/fdb-layer updated: Handle _changes
since=now param
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch prototype/fdb-layer
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/prototype/fdb-layer by this push:
new 1c1d326 Handle _changes since=now param
1c1d326 is described below
commit 1c1d32690690dea966523de203f4f7be0b2177f4
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Mon Sep 9 10:37:39 2019 -0400
Handle _changes since=now param
On master this is happening in `fabric_view_changes` but on FDB we don't go
through that module anymore, so we do in `chttpd_changes` module instead.
---
src/chttpd/src/chttpd_changes.erl | 8 +++-----
src/chttpd/src/chttpd_db.erl | 3 +++
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/chttpd/src/chttpd_changes.erl b/src/chttpd/src/chttpd_changes.erl
index c9107d1..ba81de3 100644
--- a/src/chttpd/src/chttpd_changes.erl
+++ b/src/chttpd/src/chttpd_changes.erl
@@ -106,11 +106,9 @@ handle_changes(Args1, Req, Db, Type) ->
{SNFun, undefined}
end,
Start = fun() ->
- StartSeq = case Dir of
- rev ->
- fabric2_fdb:get_update_seq(Db);
- fwd ->
- Since
+ StartSeq = case Dir =:= rev orelse Since =:= now of
+ true -> fabric2_db:get_update_seq(Db);
+ false -> Since
end,
View2 = if UseViewChanges ->
{ok, {_, View1, _}, _, _} = couch_mrview_util:get_view(
diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index 04da99c..16774a2 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -1945,6 +1945,9 @@ parse_changes_query(Req) ->
end.
+parse_since_seq(<<"now">>) ->
+ now;
+
parse_since_seq(Seq) when is_binary(Seq), size(Seq) > 30 ->
throw({bad_request, url_encoded_since_seq});