From 1c83402bd3e851c6d09d01eec04fc162b7ae1b3d Mon Sep 17 00:00:00 2001 From: animesh Date: Fri, 13 Mar 2020 20:57:58 +0530 Subject: [PATCH] Replace switch with if --- worker/background_mutation.go | 7 +++---- worker/draft.go | 9 +++------ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/worker/background_mutation.go b/worker/background_mutation.go index bc0b512cb87..464c09cee26 100644 --- a/worker/background_mutation.go +++ b/worker/background_mutation.go @@ -58,13 +58,12 @@ func (e *executor) processMutationCh(ch chan *subMutation) { for _, edge := range payload.edges { for { err := runMutation(payload.ctx, edge, ptxn) - switch { - case err == nil: + if err == nil { break - case err != posting.ErrRetry: + } + if err != posting.ErrRetry { glog.Errorf("Error while mutating: %v", err) break - default: } } } diff --git a/worker/draft.go b/worker/draft.go index 4cd8d381b11..fe53a276ce1 100644 --- a/worker/draft.go +++ b/worker/draft.go @@ -190,12 +190,9 @@ func newNode(store *raftwal.DiskStorage, gid uint32, id uint64, myAddr string) * // We need a generous size for applyCh, because raft.Tick happens every // 10ms. If we restrict the size here, then Raft goes into a loop trying // to maintain quorum health. - applyCh: make(chan []*pb.Proposal, 1000), - rollupCh: make(chan uint64, 3), - proposalCh: make(chan batch, num), - commitCh: make(chan commitBatch, num*20), - elog: trace.NewEventLog("Dgraph", "ApplyCh"), - closer: y.NewCloser(3), // Matches CLOSER:1 + applyCh: make(chan []*pb.Proposal, 1000), + elog: trace.NewEventLog("Dgraph", "ApplyCh"), + closer: y.NewCloser(3), // Matches CLOSER:1 } if x.WorkerConfig.LudicrousMode { n.ex = newExecutor()