flow/manager: no flow timeout when hash-size < 10

Fix Flow Manager error when flows were not being timed out
in case flow.hash-size < 10.
This happened because calculation of variable rows_per_sec in
flow-manager.c rounded the value to zero.

This commit ensures that variable rows_per_sec is at least 1.

Ticket: 8710
pull/15789/head
Adam Kiripolsky 4 months ago committed by Victor Julien
parent 9555e3add6
commit b8d7f894be

@ -800,7 +800,9 @@ static void GetWorkUnitSizing(const uint32_t rows, const uint32_t mp, const bool
} }
/* minimum busy score is 10 */ /* minimum busy score is 10 */
const uint32_t emp = MAX(mp, 10); const uint32_t emp = MAX(mp, 10);
const uint32_t rows_per_sec = (uint32_t)((float)rows * (float)((float)emp / (float)100)); /* ensure minimum rows_per_sec is at least 1 */
const uint32_t rows_per_sec =
MAX(1, (uint32_t)((float)rows * (float)((float)emp / (float)100)));
/* calc how much time we estimate the work will take, in ms. We assume /* calc how much time we estimate the work will take, in ms. We assume
* each row takes an average of 1usec. Maxing out at 1sec. */ * each row takes an average of 1usec. Maxing out at 1sec. */
const uint32_t work_per_unit = MIN(rows_per_sec / 1000, 1000); const uint32_t work_per_unit = MIN(rows_per_sec / 1000, 1000);

Loading…
Cancel
Save