Skip to content
Snippets Groups Projects
Unverified Commit 31fea9ae authored by Manish R Jain's avatar Manish R Jain
Browse files

Fixes:

Move all time.Tick out of for loops. Create a ticker outside the loop
and just use it's channel within.
parent 1b31c854
No related branches found
No related tags found
No related merge requests found
......@@ -334,9 +334,10 @@ func (n *node) processSnapshot(s raftpb.Snapshot) {
func (n *node) Run() {
fr := true
ticker := time.NewTicker(time.Second)
for {
select {
case <-time.Tick(time.Second):
case <-ticker.C:
n.raft.Tick()
case rd := <-n.raft.Ready():
......@@ -376,9 +377,10 @@ func (n *node) Step(ctx context.Context, msg raftpb.Message) error {
}
func (n *node) snapshotPeriodically() {
ticker := time.NewTicker(10 * time.Minute)
for {
select {
case <-time.Tick(10 * time.Minute):
case <-ticker.C:
le, err := n.store.LastIndex()
x.Checkf(err, "Unable to retrieve last index")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment