Show CPU and memory use, disable last block time for now (#40)

This commit is contained in:
Maciej Hirsz
2018-09-18 14:37:09 +02:00
committed by GitHub
parent 762db7ebdc
commit 07b5880e5f
7 changed files with 27 additions and 11 deletions
+7 -3
View File
@@ -37,6 +37,8 @@ export default class Node {
private peers = 0 as Types.PeerCount;
private txcount = 0 as Types.TransactionCount;
private memory = null as Maybe<Types.MemoryUse>;
private cpu = null as Maybe<Types.CPUUse>;
private readonly ip: string;
private readonly socket: WebSocket;
@@ -173,7 +175,7 @@ export default class Node {
}
public nodeStats(): Types.NodeStats {
return [this.peers, this.txcount];
return [this.peers, this.txcount, this.memory, this.cpu];
}
public blockDetails(): Types.BlockDetails {
@@ -223,11 +225,13 @@ export default class Node {
}
private onSystemInterval(message: SystemInterval) {
const { peers, txcount } = message;
const { peers, txcount, cpu, memory } = message;
if (this.peers !== peers || this.txcount !== txcount) {
if (this.peers !== peers || this.txcount !== txcount || this.cpu !== cpu || this.memory !== memory) {
this.peers = peers;
this.txcount = txcount;
this.cpu = cpu;
this.memory = memory;
this.events.emit('stats');
}