Class: ShardStatus

ShardingMaster. ShardStatus


new ShardStatus(id)

Stores information about a single shard that is sent to the master.
Parameters:
Name Type Description
id string The ID of the shard this status object contains data for.
Source:

Members


cpuLoad :Array.<number>

The percentage of time each CPU core has been used since the last status update.
Type:
  • Array.<number>
Default Value:
  • [0]
Source:

cpus :Array.<{model: string, speed: number, times: {user: number, nice: number, sys: number, idle: number, irq: number}}>

Raw values from the OS about CPU times. Each element in the array is a single processor thread (hyperthreading can increase the count above the number of cores). From `os.cpus()`. Used to calculate cpuLoad.
Type:
  • Array.<{model: string, speed: number, times: {user: number, nice: number, sys: number, idle: number, irq: number}}>
Source:

currentShardCount :number

The current Discord shard count this is configured for.
Type:
  • number
Source:

currentShardId :number

The current Discord shard ID of this shard. Similar to ShardingMaster.ShardInfo~currentShardId, and will in most cases update that value once received by the master.
Type:
  • number
Source:

goalShardCount :number

The goal Discord shard count this is configured for.
Type:
  • number
Source:

goalShardId :number

The goal Discord shard ID of this shard. Similar to ShardingMaster.ShardInfo~goalShardId, and is used to ensure messages were received properly.
Type:
  • number
Source:

id :string

The ID of the shard this status object contains data for.
Type:
  • string
Source:

isMaster :boolean

Is this shard considered the master shard. There must be exactly one of these configured at all times, and in most cases can run in the same directory as the ShardingMaster. This shard will be told to not connect to Discord, and act as the master node for web requests.
Type:
  • boolean
Source:

memExternal :number

Memory usage of C++ objects bound to JavaScript objects managed by V8.
Type:
  • number
Source:

memHeapTotal :number

The total memory currently available to the shard's heap in bytes. This value will expand as the total is reached, until the configured max has been reached, at which it will crash due to failing to allocate more memory.
Type:
  • number
Source:

memHeapUsed :number

The amount of memory in use of the shard's heap in bytes.
Type:
  • number
Source:

memRSS :number

Resident Set Size. Total allocated memory for the entire process.
Type:
  • number
Source:

messageCountDelta :number

The number of Discord messages received during the time since the previous status update.
Type:
  • number
Source:

messageCountTotal :number

The number of Discord messages received during the entire time the shard has been running (resets if shard reboots).
Type:
  • number
Source:

ping :number

The average ping time from the shard to Discord since the last status update.
Type:
  • number
Source:

startTime :number

The timestamp at which the shard was most recently started.
Type:
  • number
Source:

stopTime :number

The timestamp at which the shard was most recently stopped.
Type:
  • number
Source:

storageUsedTotal :number

The total storage space used by the bot in its installed directory in bytes.
Type:
  • number
Source:

storageUsedUsers :number

The total storage space used by user data.
Type:
  • number
Source:

timeDelta :number

The difference in time since the previous status update in milliseconds. A value of 0 can be assumed to mean this is the first update in a series.
Type:
  • number
Source:

timestamp :number

The timestamp at which this status was generated. This defaults to `Date.now()`, but is expected to be overridden to a more accurate value.
Type:
  • number
Source:

Methods


<static> from(obj [, id])

Convert a given object to a ShardStatus object. Values are only copied if their types exactly match.
Parameters:
Name Type Argument Description
obj object The ShardStatus-like object to copy.
id string <optional>
If the given object does not specify the shard's ID, it may be passed here instead.
Source:
Returns:
Created ShardStatus object.
Type
ShardingMaster.ShardStatus

reset()

Reset all necessary values to clear the state of the previous instance.
Source:

update(obj)

Update the current object with values received.
Parameters:
Name Type Description
obj object The object with values to copy over.
Source: