You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2020/04/09 21:20:56 UTC
[couchdb] branch prototype/fdb-layer updated: Fix division by zero
This is an automated email from the ASF dual-hosted git repository.
davisp 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 daf1082 Fix division by zero
daf1082 is described below
commit daf10824af695669dde61828414e8aff9e2de9d9
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Apr 9 10:42:18 2020 -0500
Fix division by zero
---
src/couch_rate/src/couch_rate_limiter.erl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/couch_rate/src/couch_rate_limiter.erl b/src/couch_rate/src/couch_rate_limiter.erl
index 349da8d..6f852b1 100644
--- a/src/couch_rate/src/couch_rate_limiter.erl
+++ b/src/couch_rate/src/couch_rate_limiter.erl
@@ -135,6 +135,8 @@ budget(Id, #?STATE{} = State) ->
overloaded ->
%% decrease budget
{max(1, round(R * MultiplicativeFactor)), State};
+ underloaded when W == 0 orelse Latency == 0 ->
+ {max(1, round(MR)), State};
underloaded ->
ReadWriteRatio = min(1, MR / max(1, MW)),
SingleWrite = Latency / W,