From b646c4a76b3aa318a8d7df04458868bb106582b2 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Tue, 29 Nov 2022 13:24:54 +0800 Subject: [PATCH] update missing count in a fixed period --- src/views/Uptime.vue | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/views/Uptime.vue b/src/views/Uptime.vue index 19e81374..950e2565 100644 --- a/src/views/Uptime.vue +++ b/src/views/Uptime.vue @@ -283,19 +283,11 @@ export default { if (cached) { this.validators = cached } + this.fetchMissingInfo() this.$http.getValidatorList().then(res => { this.validators = res }) - this.$http.getSlashingSigningInfo().then(res => { - if (res.info) { - res.info.forEach(x => { - if (x.address) { - const hex = toBase64(fromBech32(x.address).data) - this.missing[hex] = x - } - }) - } - }) + this.initBlocks() }, beforeDestroy() { @@ -304,6 +296,18 @@ export default { clearInterval(this.timer) }, methods: { + fetchMissingInfo() { + this.$http.getSlashingSigningInfo().then(res => { + if (res.info) { + res.info.forEach(x => { + if (x.address) { + const hex = toBase64(fromBech32(x.address).data) + this.missing[hex] = x + } + }) + } + }) + }, pinValidator() { localStorage.setItem('pinned', this.pinned) }, @@ -387,6 +391,9 @@ export default { if (x.validator_address) sigs[x.validator_address] = 'bg-success' }) this.height = res.block.header.height + if (Number(this.height) % 100 === 0) { // update the missing number each 100 + this.fetchMissingInfo() + } const block = this.blocks.find(b => b.height === res.block.last_commit.height) if (typeof block === 'undefined') { // mei // this.$set(block, 0, typeof sigs !== 'undefined')