1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #34446 from alphaappsinc/master

Allow patching polling interval logarithmic multiplier
This commit is contained in:
Rafael França 2018-11-14 16:50:57 -05:00 committed by GitHub
commit f9ba12bd53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -238,8 +238,8 @@
}, this.getPollInterval()); }, this.getPollInterval());
}; };
ConnectionMonitor.prototype.getPollInterval = function getPollInterval() { ConnectionMonitor.prototype.getPollInterval = function getPollInterval() {
var _constructor$pollInte = this.constructor.pollInterval, min = _constructor$pollInte.min, max = _constructor$pollInte.max; var _constructor$pollInte = this.constructor.pollInterval, min = _constructor$pollInte.min, max = _constructor$pollInte.max, multiplier = _constructor$pollInte.multiplier;
var interval = 5 * Math.log(this.reconnectAttempts + 1); var interval = multiplier * Math.log(this.reconnectAttempts + 1);
return Math.round(clamp(interval, min, max) * 1e3); return Math.round(clamp(interval, min, max) * 1e3);
}; };
ConnectionMonitor.prototype.reconnectIfStale = function reconnectIfStale() { ConnectionMonitor.prototype.reconnectIfStale = function reconnectIfStale() {
@ -275,7 +275,8 @@
}(); }();
ConnectionMonitor.pollInterval = { ConnectionMonitor.pollInterval = {
min: 3, min: 3,
max: 30 max: 30,
multiplier: 5
}; };
ConnectionMonitor.staleThreshold = 6; ConnectionMonitor.staleThreshold = 6;
var Consumer = function() { var Consumer = function() {