Skip to content

Commit

Permalink
Feat/log catchup (#877)
Browse files Browse the repository at this point in the history
* add logging when doing catchup

* adding decision log

* log for full queue for sync beacon

* Update chain/beacon/node.go

* Apply suggestions from code review

Co-authored-by: Yolan Romailler <AnomalRoil@users.noreply.github.com>
  • Loading branch information
nikkolasg and AnomalRoil committed Mar 30, 2022
1 parent 8bdec4b commit fdd6145
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions chain/beacon/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func (c *chainStore) tryAppend(last, newB *chain.Beacon) bool {
// only send if it's not full already
case c.catchupBeacons <- newB:
default:
c.l.Debugw("", "chain_store", "catchup", "channel", "full")
}
return true
}
Expand Down
3 changes: 3 additions & 0 deletions chain/beacon/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ func (h *Handler) run(startTime int64) {
go h.chain.RunSync(context.Background(), current.round, nil)
}
case b := <-h.chain.AppendedBeaconNoSync():
h.l.Debugw("", "beacon_loop", "catchupmode", "last_is", b.Round, "current", current.round, "catchup_launch", b.Round < current.round)
if b.Round < current.round {
// When network is down, all alive nodes will broadcast their
// signatures periodically with the same period. As soon as one
Expand All @@ -339,7 +340,9 @@ func (h *Handler) run(startTime int64) {
// channel will trigger again etc until we arrive at the correct
// round.
go func(c roundInfo, latest *chain.Beacon) {
h.l.Debugw("sleeping now", "beacon_loop", "catchupmode", "last_is", latest.Round, "seep_for", h.conf.Group.CatchupPeriod)
h.conf.Clock.Sleep(h.conf.Group.CatchupPeriod)
h.l.Debugw("broadcast next partial", "beacon_loop", "catchupmode", "last_is", latest.Round)
h.broadcastNextPartial(c, latest)
}(current, b)
}
Expand Down

0 comments on commit fdd6145

Please sign in to comment.