Fix repeated get_updates resets due to unsuspend event handler errors.

(imported from commit 6d303e84b4320c23a5f16260f859a943dc942836)
This commit is contained in:
Tim Abbott 2013-12-19 17:19:09 -05:00
parent bdcc2e5c52
commit 71a55808f7
1 changed files with 3 additions and 0 deletions

View File

@ -1196,6 +1196,9 @@ var watchdog_time = $.now();
setInterval(function () {
var new_time = $.now();
if ((new_time - watchdog_time) > 20000) { // 20 seconds.
// Defensively reset watchdog_time here in case there's an
// exception in one of the event handlers
watchdog_time = new_time;
// Our app's JS wasn't running, which probably means the machine was
// asleep.
$(document).trigger($.Event('unsuspend'));