Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

Commit

Permalink
Name the variable _pings instead
Browse files Browse the repository at this point in the history
  • Loading branch information
izy521 committed Jan 6, 2017
1 parent b76fda4 commit 33985f3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
});
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 33985f3

Please sign in to comment.