From e513f05c09f568d49e4642f413b85ccf3fdc0300 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Thu, 5 Sep 2024 20:55:48 +0000 Subject: [PATCH] Fix reorg to lower height on /monitoring status page --- .../server-health/server-health.component.html | 4 ++-- .../server-health/server-health.component.ts | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/components/server-health/server-health.component.html b/frontend/src/app/components/server-health/server-health.component.html index e2f76d786..6a0a905f9 100644 --- a/frontend/src/app/components/server-health/server-health.component.html +++ b/frontend/src/app/components/server-health/server-health.component.html @@ -9,7 +9,7 @@
- +
@@ -27,7 +27,7 @@ - +
{{ getLastUpdateSeconds(host) }} {{ (host.rtt / 1000) | number : '1.1-1' }} {{ host.rtt == null ? '' : 's'}} {{ !host.checked ? '⏳' : (host.unreachable ? '🔥' : '✅') }} {{ host.rtt | number : '1.0-0' }} {{ host.rtt == null ? '' : 'ms'}} {{ !host.checked ? '⏳' : (host.unreachable ? '🔥' : '✅') }}{{ host.latestHeight }} {{ !host.checked ? '⏳' : (host.outOfSync ? '🚫' : (host.latestHeight && host.latestHeight < tip ? '🟧' : '✅')) }}{{ host.latestHeight }} {{ !host.checked ? '⏳' : (host.outOfSync ? '🚫' : (host.latestHeight && host.latestHeight < maxHeight ? '🟧' : '✅')) }}
diff --git a/frontend/src/app/components/server-health/server-health.component.ts b/frontend/src/app/components/server-health/server-health.component.ts index 37e23f12a..d10f3f0b6 100644 --- a/frontend/src/app/components/server-health/server-health.component.ts +++ b/frontend/src/app/components/server-health/server-health.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit, ChangeDetectionStrategy, SecurityContext, ChangeDetectorRef } from '@angular/core'; import { WebsocketService } from '../../services/websocket.service'; -import { Observable, Subject, map } from 'rxjs'; +import { Observable, Subject, map, tap } from 'rxjs'; import { StateService } from '../../services/state.service'; import { HealthCheckHost } from '../../interfaces/websocket.interface'; import { DomSanitizer } from '@angular/platform-browser'; @@ -13,7 +13,7 @@ import { DomSanitizer } from '@angular/platform-browser'; }) export class ServerHealthComponent implements OnInit { hosts$: Observable; - tip$: Subject; + maxHeight: number; interval: number; now: number = Date.now(); @@ -44,9 +44,14 @@ export class ServerHealthComponent implements OnInit { host.flag = this.parseFlag(host.host); } return hosts; + }), + tap(hosts => { + let newMaxHeight = 0; + for (const host of hosts) { + newMaxHeight = Math.max(newMaxHeight, host.latestHeight); + } }) ); - this.tip$ = this.stateService.chainTip$; this.websocketService.want(['mempool-blocks', 'stats', 'blocks', 'tomahawk']); this.interval = window.setInterval(() => {