kopia lustrzana https://github.com/bugout-dev/moonstream
commit
8421802db3
|
@ -108,7 +108,12 @@ func (node *Node) UpdateNodeState(currentBlock uint64, alive bool) (callCounter
|
|||
// IncreaseCallCounter increased to 1 each time node called
|
||||
func (node *Node) IncreaseCallCounter() {
|
||||
node.mux.Lock()
|
||||
node.CallCounter++
|
||||
if node.CallCounter >= NB_MAX_COUNTER_NUMBER {
|
||||
log.Printf("Number of calls for node %s reached %d limit, reset the counter.", node.Endpoint, NB_MAX_COUNTER_NUMBER)
|
||||
node.CallCounter = uint64(0)
|
||||
} else {
|
||||
node.CallCounter++
|
||||
}
|
||||
node.mux.Unlock()
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ var (
|
|||
NB_CACHE_CLEANING_INTERVAL = time.Second * 10
|
||||
NB_CACHE_ACCESS_ID_LIFETIME = int64(120)
|
||||
|
||||
NB_MAX_COUNTER_NUMBER = uint64(10000000)
|
||||
|
||||
// Client configuration
|
||||
NB_CLIENT_NODE_KEEP_ALIVE = int64(5) // How long to store node in hot list for client in seconds
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue