MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / nextTick

Method nextTick

sqlchain/runtime.go:228–239  ·  view source on GitHub ↗

nextTick returns the current clock reading and the duration till the next turn. If duration is less or equal to 0, use the clock reading to run the next cycle - this avoids some problem caused by concurrently time synchronization.

()

Source from the content-addressed store, hash-verified

226// is less or equal to 0, use the clock reading to run the next cycle - this avoids some problem
227// caused by concurrently time synchronization.
228func (r *runtime) nextTick() (t time.Time, d time.Duration) {
229 r.stateMutex.Lock()
230 defer r.stateMutex.Unlock()
231 t = r.now()
232 d = r.chainInitTime.Add(time.Duration(r.nextTurn) * r.period).Sub(t)
233
234 if d > r.tick {
235 d = r.tick
236 }
237
238 return
239}
240
241func (r *runtime) updatePeers(peers *proto.Peers) (err error) {
242 r.peersMutex.Lock()

Callers 1

mainCycleMethod · 0.45

Calls 2

nowMethod · 0.95
AddMethod · 0.45

Tested by

no test coverage detected