Merge pull request #1732 from chaosma/ss

fix state syncing ticker leak; adjust syncing loop parameters
pull/1733/head
chaosma 5 years ago committed by GitHub
commit 115adc60be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      api/service/syncing/syncing.go
  2. 6
      node/node_syncing.go

@ -747,6 +747,7 @@ func (ss *StateSync) SyncLoop(bc *core.BlockChain, worker *worker.Worker, isBeac
}
// remove SyncLoopFrequency
ticker := time.NewTicker(SyncLoopFrequency * time.Second)
defer ticker.Stop()
Loop:
for {
select {

@ -25,8 +25,8 @@ import (
const (
lastMileThreshold = 4
inSyncThreshold = 1 // unit in number of block
SyncFrequency = 10 // unit in second
BeaconSyncFrequency = 5 // unit in second
SyncFrequency = 60 // unit in second
BeaconSyncFrequency = 60 // unit in second
MinConnectedPeers = 10 // minimum number of peers connected to in node syncing
)
@ -226,6 +226,7 @@ SyncingLoop:
}
utils.Logger().Debug().Int("len", node.stateSync.GetActivePeerNumber()).Msg("[SYNC] Get Active Peers")
}
// TODO: treat fake maximum height
if node.stateSync.IsOutOfSync(bc) {
node.stateMutex.Lock()
node.State = NodeNotInSync
@ -247,6 +248,7 @@ SyncingLoop:
node.stateMutex.Lock()
node.State = NodeReadyForConsensus
node.stateMutex.Unlock()
// TODO on demand syncing
time.Sleep(SyncFrequency * time.Second)
}
}

Loading…
Cancel
Save