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 14:50:55 UTC

[couchdb] branch prototype/fdb-layer-changes-now created (now e41a034)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch prototype/fdb-layer-changes-now
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at e41a034  Handle _changes since=now param

This branch includes the following new commits:

     new e41a034  Handle _changes since=now param

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Handle _changes since=now param

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch prototype/fdb-layer-changes-now
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit e41a034d59fec330581d28608cef3eb4768ce90a
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});