aboutsummaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2016-04-14 11:12:15 +0200
committerChristoph Wurst <christoph@owncloud.com>2016-04-18 14:19:26 +0200
commit2d772eaaa8dfe6a8aeba9a67b50fafd2c74c0c0c (patch)
tree9391eeef11d62c9420716076bdc94c20500f1765 /core/js/js.js
parent54f6c05c79a1d01c32c016477c6ae2220e754b13 (diff)
downloadnextcloud-server-2d772eaaa8dfe6a8aeba9a67b50fafd2c74c0c0c.tar.gz
nextcloud-server-2d772eaaa8dfe6a8aeba9a67b50fafd2c74c0c0c.zip
Debounce heartbeat ajax calls to lower the number of requests
fixes #22397
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 598e0dcd185..802b5de7e18 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1498,9 +1498,15 @@ function initCore() {
interval = maxInterval;
}
var url = OC.generateUrl('/heartbeat');
- setInterval(function(){
- $.post(url);
- }, interval * 1000);
+ var heartBeatTimeout = null;
+ var heartBeat = function() {
+ clearTimeout(heartBeatTimeout);
+ heartBeatTimeout = setInterval(function() {
+ $.post(url);
+ }, interval * 1000);
+ };
+ $(document).ajaxComplete(heartBeat);
+ heartBeat();
}
// session heartbeat (defaults to enabled)