scheduler: fix backoff jitter calculation (#798 #670 #649)
scheduler: fix backoff jitter calculation (#798 #670 #649)

The backoff jitter algorithm helps to define a suggested 'sleep' time for
retries, the current algorithm is broken where in some cases it generate
an invalid negative number leading to issues when using OS syscalls to
set timers, the following error is visible:

   timerfd_settime: Invalid argument, errno=22 at ...mk_core/mk_event_epoll.c:190

This patch fix the exponential calculation and adjust properly the final value.

Signed-off-by: Eduardo Silva <81f705dc2ce1a61a2621e0e4b442a9474e1d0c70@treasure-data.com>

nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit