From 33985f387f03e3b88ff25449575d61991bb76374 Mon Sep 17 00:00:00 2001 From: izy521 Date: Fri, 6 Jan 2017 15:56:18 +0300 Subject: [PATCH] Name the variable `_pings` instead --- lib/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/index.js b/lib/index.js index 64db3b7b..9637c65a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1637,12 +1637,12 @@ function checkForAllServers(client, ready, message) { } function setupPing(obj) { applyProperties(obj, [ - ["_ping", []], + ["_pings", []], ["_lastHB", 0] ]); Object.defineProperty(obj, 'ping', { get: function() { - return ((obj._ping.reduce(function(p, c) { return p + c; }, 0) / obj._ping.length) || 0) | 0; + return ((obj._pings.reduce(function(p, c) { return p + c; }, 0) / obj._pings.length) || 0) | 0; }, set: function() {} }); @@ -1699,8 +1699,8 @@ function handleWSMessage(opts, data, flags) { if (message.op === 11) { clearTimeout(client.internals.heartbeat); - client.internals._ping.unshift(Date.now() - client.internals._lastHB); - client.internals._ping = client.internals._ping.slice(0, 10); + client.internals._pings.unshift(Date.now() - client.internals._lastHB); + client.internals._pings = client.internals._pings.slice(0, 10); } //Events