Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
receiver: set a maximal bound for sending probes to supervisor
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentbernat committed Nov 14, 2016
1 parent 6bfac88 commit 147f426
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/scripts/receiver/supervisor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = (function(window) {
'use strict';

var maxDelay = 5000; // maximum delay between two probes

// Extract timeout from location hash
function timeoutFromLocationHash() {
var timeouts = window.location.hash.slice(1).split(/[,#]/)
Expand Down Expand Up @@ -39,7 +41,8 @@ module.exports = (function(window) {
window.clearTimeout(lastTimeout);
}
if (timeout) {
lastTimeout = window.setTimeout(ready, timeout * 0.3);
var delay = Math.min(timeout * 0.3, maxDelay);
lastTimeout = window.setTimeout(ready, delay);
}
};

Expand Down

0 comments on commit 147f426

Please sign in to comment.