fix(WebSocketShard): report correct resumed event count (#3019)

This PR attempts to fix the reported resumed event count in the debug output (where it is always displayed only as 1 event replayed) and in the emitted `resumed` event, where it passed the current sequence instead of passing the actual replayed event count (which was an utopic high number for smaller bots on resume).
This commit is contained in:
Marcel Menzel
2019-02-02 11:28:45 +01:00
committed by SpaceEEC
parent 2dcdc798ac
commit f2ed93c08a

View File

@@ -49,7 +49,7 @@ class WebSocketShard extends EventEmitter {
* @type {number}
* @private
*/
this.closeSequence = 0;
this.closeSequence = oldShard ? oldShard.closeSequence : 0;
/**
* The current session id of the WebSocket
@@ -223,7 +223,7 @@ class WebSocketShard extends EventEmitter {
case WSEvents.RESUMED: {
this.trace = packet.d._trace;
this.status = Status.READY;
const replayed = packet.s - this.sequence;
const replayed = packet.s - this.closeSequence;
this.debug(`RESUMED ${this.trace.join(' -> ')} | replayed ${replayed} events.`);
this.heartbeat();
break;