Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

util: Fix call_function_periodically.

Tim Abbott5f4e1de661fa
diff --git a/web/src/util.ts b/web/src/util.ts
index 515150c08aa..3a235ab6c7c 100644
--- a/web/src/util.ts
+++ b/web/src/util.ts
@@ -410,9 +410,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] {