From 1765ba8921888071fff33f02f7575f9b288a77ca Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 21 Feb 2020 11:54:48 -0800 Subject: [PATCH] ircd::m::typing: Add conf item for timeout worker interval. --- matrix/typing.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/matrix/typing.cc b/matrix/typing.cc index c55a8bc7f..3d9f3b670 100644 --- a/matrix/typing.cc +++ b/matrix/typing.cc @@ -49,6 +49,13 @@ timeout_min { "default", 15 * 1000L }, }; +conf::item +timeout_int +{ + { "name", "ircd.typing.timeout.int" }, + { "default", 5 * 1000L }, +}; + static system_point calc_timesout(milliseconds relative); static bool update_state(const m::edu::m_typing &); @@ -325,15 +332,14 @@ void __attribute__((noreturn)) timeout_worker() { - while(1) + for(;; ctx::sleep(milliseconds(timeout_int))) { timeout_dock.wait([] { return !typists.empty(); }); - if(!timeout_check()) - ctx::sleep(seconds(5)); + timeout_check(); } }