From 7c5e43fd23f6ba2c2dcaf852b3a1edb36ffef26c Mon Sep 17 00:00:00 2001 From: Marvin Roger Date: Thu, 13 Apr 2017 09:46:31 +0200 Subject: [PATCH] :art: Make use of exponent --- lib/peer_client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/peer_client.js b/lib/peer_client.js index 71b4632..3df31dc 100644 --- a/lib/peer_client.js +++ b/lib/peer_client.js @@ -197,7 +197,7 @@ PeerClient.prototype.generateBackoff = function(attempt) { } const random = parseInt(Math.random() * this.reconnect.maxRandomOffset); - const backoff = (Math.pow(2, attempt) * this.reconnect.min); + const backoff = (2 ** attempt * this.reconnect.min); if (backoff > this.reconnect.max) { return this.reconnect.max + random; } else {