mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-11 20:01:10 +00:00
Add network state to backend (#123)
This commit is contained in:
committed by
Maciej Hirsz
parent
1023b72fe7
commit
0134677c2d
@@ -31,6 +31,7 @@ export default class Node {
|
||||
|
||||
public readonly events = new EventEmitter() as EventEmitter & NodeEvents;
|
||||
|
||||
public networkState: Maybe<Types.NetworkState> = null;
|
||||
public location: Maybe<Location> = null;
|
||||
public lastMessage: Types.Timestamp;
|
||||
public config: string;
|
||||
@@ -239,6 +240,7 @@ export default class Node {
|
||||
|
||||
private onSystemInterval(message: SystemInterval) {
|
||||
const {
|
||||
network_state,
|
||||
peers,
|
||||
txcount,
|
||||
cpu,
|
||||
@@ -249,6 +251,10 @@ export default class Node {
|
||||
finalized_hash: finalizedHash
|
||||
} = message;
|
||||
|
||||
if (this.networkState !== network_state && network_state) {
|
||||
this.networkState = network_state;
|
||||
};
|
||||
|
||||
if (this.peers !== peers || this.txcount !== txcount) {
|
||||
this.peers = peers;
|
||||
this.txcount = txcount;
|
||||
|
||||
@@ -53,6 +53,7 @@ export interface SystemConnected {
|
||||
|
||||
export interface SystemInterval extends BestBlock {
|
||||
msg: 'system.interval';
|
||||
network_state: Maybe<Types.NetworkState>;
|
||||
txcount: Types.TransactionCount;
|
||||
peers: Types.PeerCount;
|
||||
memory: Maybe<Types.MemoryUse>;
|
||||
|
||||
@@ -24,6 +24,7 @@ export type MemoryUse = Opaque<number, 'MemoryUse'>;
|
||||
export type CPUUse = Opaque<number, 'CPUUse'>;
|
||||
export type BytesPerSecond = Opaque<number, 'BytesPerSecond'>;
|
||||
export type NetworkId = Opaque<string, 'NetworkId'>;
|
||||
export type NetworkState = Opaque<string, 'NetworkState'>;
|
||||
|
||||
export type BlockDetails = [BlockNumber, BlockHash, Milliseconds, Timestamp, Maybe<PropagationTime>];
|
||||
export type NodeDetails = [NodeName, NodeImplementation, NodeVersion, Maybe<Address>, Maybe<NetworkId>];
|
||||
|
||||
Reference in New Issue
Block a user