diff options
author | Husam Bilal <husam@alphaappsinc.com> | 2018-11-14 11:30:40 +0200 |
---|---|---|
committer | Husam Bilal <husam@alphaappsinc.com> | 2018-11-14 11:30:47 +0200 |
commit | 30a0c7e04093add0b14be6da17c7496e7dd40e10 (patch) | |
tree | e101c2ac1cb593e574ad95789c53492a8424e747 /actioncable | |
parent | 79d2d33489728f06838322d84da8de8f05b6afa1 (diff) | |
download | rails-30a0c7e04093add0b14be6da17c7496e7dd40e10.tar.gz rails-30a0c7e04093add0b14be6da17c7496e7dd40e10.tar.bz2 rails-30a0c7e04093add0b14be6da17c7496e7dd40e10.zip |
Allow patching polling interval logarithmic multiplier
Diffstat (limited to 'actioncable')
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable.js b/actioncable/app/assets/javascripts/action_cable.js index df60b1fc24..07151b9d25 100644 --- a/actioncable/app/assets/javascripts/action_cable.js +++ b/actioncable/app/assets/javascripts/action_cable.js @@ -238,8 +238,8 @@ }, this.getPollInterval()); }; ConnectionMonitor.prototype.getPollInterval = function getPollInterval() { - var _constructor$pollInte = this.constructor.pollInterval, min = _constructor$pollInte.min, max = _constructor$pollInte.max; - var interval = 5 * Math.log(this.reconnectAttempts + 1); + var _constructor$pollInte = this.constructor.pollInterval, min = _constructor$pollInte.min, max = _constructor$pollInte.max, multiplier = _constructor$pollInte.multiplier; + var interval = multiplier * Math.log(this.reconnectAttempts + 1); return Math.round(clamp(interval, min, max) * 1e3); }; ConnectionMonitor.prototype.reconnectIfStale = function reconnectIfStale() { @@ -275,7 +275,8 @@ }(); ConnectionMonitor.pollInterval = { min: 3, - max: 30 + max: 30, + multiplier: 5 }; ConnectionMonitor.staleThreshold = 6; var Consumer = function() { |