Correct active clients logging

pull/519/head
kompotkot 2022-01-17 11:16:31 +00:00
rodzic aab3b8f4ac
commit c2f95e9217
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -2,7 +2,6 @@ package cmd
import ( import (
"errors" "errors"
"log"
"reflect" "reflect"
"time" "time"
@ -82,7 +81,7 @@ func (cpool *ClientPool) GetClientNode(id string) *Node {
} }
// Clean client list of hot outdated nodes // Clean client list of hot outdated nodes
func (cpool *ClientPool) CleanInactiveClientNodes() { func (cpool *ClientPool) CleanInactiveClientNodes() int {
cnt := 0 cnt := 0
for id, client := range cpool.Client { for id, client := range cpool.Client {
lastCallTs := client.GetClientLastCallDiff() lastCallTs := client.GetClientLastCallDiff()
@ -93,5 +92,5 @@ func (cpool *ClientPool) CleanInactiveClientNodes() {
} }
} }
log.Printf("Active clients: %d\n", cnt) return cnt
} }

Wyświetl plik

@ -27,8 +27,9 @@ func initHealthCheck(debug bool) {
select { select {
case <-t.C: case <-t.C:
blockchainPool.HealthCheck() blockchainPool.HealthCheck()
ethereumClientPool.CleanInactiveClientNodes() ethereumClients := ethereumClientPool.CleanInactiveClientNodes()
polygonClientPool.CleanInactiveClientNodes() polygonClients := polygonClientPool.CleanInactiveClientNodes()
log.Printf("Active etehereum clients: %d, polygon clients: %d\n", ethereumClients, polygonClients)
if debug { if debug {
blockchainPool.StatusLog() blockchainPool.StatusLog()
} }