mirror of https://github.com/zulip/zulip.git
util: Fix call_function_periodically.
This function incorrectly and misleadingly did an immediate initial
call, despite both of its callers doing immediate calls themselves (in
one case, with a different parameter passed).
This led to unnecessary server load when reloading the app via event
system triggered reloads, since every client would call `/` twice.
(cherry picked from commit 2c56978b02
)
This commit is contained in:
parent
2794c779da
commit
187c9e4b14
|
@ -408,9 +408,12 @@ export function call_function_periodically(callback: () => void, delay: number):
|
|||
// calling "callback".
|
||||
setTimeout(() => {
|
||||
call_function_periodically(callback, delay);
|
||||
}, delay);
|
||||
|
||||
callback();
|
||||
// Do the callback after scheduling the next call, so that we
|
||||
// are certain to call it again even if the callback throws an
|
||||
// exception.
|
||||
callback();
|
||||
}, delay);
|
||||
}
|
||||
|
||||
export function get_string_diff(string1: string, string2: string): [number, number, number] {
|
||||
|
|
Loading…
Reference in New Issue