kopia lustrzana https://github.com/bugout-dev/moonstream
Correct active clients logging
rodzic
aab3b8f4ac
commit
c2f95e9217
|
@ -2,7 +2,6 @@ package cmd
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
|
@ -82,7 +81,7 @@ func (cpool *ClientPool) GetClientNode(id string) *Node {
|
|||
}
|
||||
|
||||
// Clean client list of hot outdated nodes
|
||||
func (cpool *ClientPool) CleanInactiveClientNodes() {
|
||||
func (cpool *ClientPool) CleanInactiveClientNodes() int {
|
||||
cnt := 0
|
||||
for id, client := range cpool.Client {
|
||||
lastCallTs := client.GetClientLastCallDiff()
|
||||
|
@ -93,5 +92,5 @@ func (cpool *ClientPool) CleanInactiveClientNodes() {
|
|||
}
|
||||
}
|
||||
|
||||
log.Printf("Active clients: %d\n", cnt)
|
||||
return cnt
|
||||
}
|
||||
|
|
|
@ -27,8 +27,9 @@ func initHealthCheck(debug bool) {
|
|||
select {
|
||||
case <-t.C:
|
||||
blockchainPool.HealthCheck()
|
||||
ethereumClientPool.CleanInactiveClientNodes()
|
||||
polygonClientPool.CleanInactiveClientNodes()
|
||||
ethereumClients := ethereumClientPool.CleanInactiveClientNodes()
|
||||
polygonClients := polygonClientPool.CleanInactiveClientNodes()
|
||||
log.Printf("Active etehereum clients: %d, polygon clients: %d\n", ethereumClients, polygonClients)
|
||||
if debug {
|
||||
blockchainPool.StatusLog()
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue