()
| 54 | private requestCount = 0; |
| 55 | |
| 56 | constructor() { |
| 57 | // system information table |
| 58 | setInterval(() => { |
| 59 | const info = systemInfo(); |
| 60 | if (info) { |
| 61 | this.systemChart.push({ |
| 62 | cpu: Number((info.cpuUsage * 100).toFixed(1)), |
| 63 | mem: Number((info.memUsage * 100).toFixed(1)) |
| 64 | }); |
| 65 | } else { |
| 66 | this.systemChart.push({ |
| 67 | cpu: 0, |
| 68 | mem: 0 |
| 69 | }); |
| 70 | } |
| 71 | }, 1000 * 10); |
| 72 | |
| 73 | // state table |
| 74 | setInterval(async () => { |
| 75 | // Calculate the total number of instances and the number of running instances |
| 76 | const remoteInfoList = new Array(); |
| 77 | for (const iterator of RemoteServiceSubsystem.services.entries()) { |
| 78 | try { |
| 79 | remoteInfoList.push(await new RemoteRequest(iterator[1]).request("info/overview")); |
| 80 | } catch (err) {} |
| 81 | } |
| 82 | let totalInstance = 0; |
| 83 | let runningInstance = 0; |
| 84 | for (const iterator of remoteInfoList) { |
| 85 | if (iterator.instance) { |
| 86 | totalInstance += iterator.instance.total; |
| 87 | runningInstance += iterator.instance.running; |
| 88 | } |
| 89 | } |
| 90 | this.statusChart.push({ |
| 91 | value: this.requestCount, |
| 92 | totalInstance, |
| 93 | runningInstance |
| 94 | }); |
| 95 | this.requestCount = 0; |
| 96 | }, 1000 * 10); |
| 97 | } |
| 98 | |
| 99 | addRequestCount() { |
| 100 | this.requestCount++; |
nothing calls this directly
no test coverage detected