fix: Sharding Issues & Cleanup (#2952)

* fix: Sharding causing constant heartbeat / identify spam

* misc: Remove wait param in connect

* misc: Wait 2.5 seconds before sending identify again if session is resumable

* misc: Remove useless destroy call

* nit: Capitalization

* fix: Identify on HELLO not connectionOpen

* misc: Add different intervals for identify after invalid session
- 2500 if we couldn't resume in time
- 5000 if we didn't have a session ID (per the docs on identify, that a client can only connect every 5 seconds)
- Otherwise, just identify again

* misc: Only clear heartbeat if shard is fully dead

Reconnect clears it otherwise

* fix: Accessing .length on a Collection
This commit is contained in:
Frangu Vlad
2018-11-21 21:42:37 +02:00
committed by Isabella
parent 377ecd73ea
commit 9085138f0d
6 changed files with 55 additions and 29 deletions

View File

@@ -27,7 +27,7 @@ class ShardingManager extends EventEmitter {
/**
* @param {string} file Path to your shard script file
* @param {Object} [options] Options for the sharding manager
* @param {string|number[]} [options.totalShards='auto'] Number of total shards of all shard managers or "auto"
* @param {string|number} [options.totalShards='auto'] Number of total shards of all shard managers or "auto"
* @param {string|number[]} [options.shardList='auto'] List of shards to spawn or "auto"
* @param {ShardingManagerMode} [options.mode='process'] Which mode to use for shards
* @param {boolean} [options.respawn=true] Whether shards should automatically respawn upon exiting