BUG/MINOR: time: fix idle time computation for long sleeps
authorWilly Tarreau <w@1wt.eu>
Fri, 27 Aug 2021 21:16:58 +0000 (23:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 Aug 2021 21:36:20 +0000 (23:36 +0200)
commite365aa28d4f30b3d98118ab460c856d3aa72c75e
tree675ef185eb348cc9b4c4fc60ebd5648f4cceb521
parent310a260e4a1cec902746a5e8d85dbe6a9bf6d0c6
BUG/MINOR: time: fix idle time computation for long sleeps

In 2.4 we extended the max poll time from 1s to 60s with commit
4f59d3861 ("MINOR: time: increase the minimum wakeup interval to 60s").

This had the consequence that the calculation of the idle time percentage
may overflow during the multiply by 100 if the thread had slept 43s or
more. Let's change this to a 64 bit computation. This will have no
performance impact since this is done at most twice per second.

This should fix github issue #1366.

This must be backported to 2.4.
include/haproxy/time.h