garrensmith commented on a change in pull request #2662: Use `couch_rate` 
application for `couch_view`
URL: https://github.com/apache/couchdb/pull/2662#discussion_r401428207
 
 

 ##########
 File path: src/couch_views/src/couch_views_indexer.erl
 ##########
 @@ -156,7 +159,25 @@ add_error(Error, Reason, Data) ->
 
 
 update(#{} = Db, Mrst0, State0) ->
-    {Mrst2, State4} = fabric2_fdb:transactional(Db, fun(TxDb) ->
+    Limiter = maps:get(limiter, State0),
+    case couch_rate:budget(Limiter) of
+        0 ->
+            couch_rate:wait(Limiter),
+            update(Db, Mrst0, State0);
+        Limit ->
+            {Mrst2, State4} = update_txn(Db, Mrst0, State0#{limit => Limit, 
limiter => Limiter}),
 
 Review comment:
   Could you change this to `{Mrst1, State1}` 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to