Commit 63c11c4e authored by Maged Michael's avatar Maged Michael Committed by Facebook GitHub Bot

DynamicBoundedQueue: Round threshold up to avoid threshold 0

Summary: Ensure that threshold is not 0, otherwise when capacity < 10, threshold is 0, which can lead to consumers never transferring credit to producers.

Differential Revision: D26791831

fbshipit-source-id: 741bcf17de18198e43471d4b36d98c79288652fb
parent 626e5caf
...@@ -444,7 +444,7 @@ class DynamicBoundedQueue { ...@@ -444,7 +444,7 @@ class DynamicBoundedQueue {
// Calculation of threshold to move credits in bulk from consumers // Calculation of threshold to move credits in bulk from consumers
// to producers // to producers
constexpr Weight threshold(Weight capacity) const noexcept { constexpr Weight threshold(Weight capacity) const noexcept {
return capacity / 10; return (capacity + 9) / 10;
} }
// Functions called frequently by producers // Functions called frequently by producers
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment