Skip to content

Commit

Permalink
clean code + typos
Browse files Browse the repository at this point in the history
  • Loading branch information
cortze committed Oct 27, 2022
1 parent f4817f0 commit de370a8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pkg/analyzer/process_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ import (
func (s *StateAnalyzer) runProcessState(wgProcess *sync.WaitGroup, downloadFinishedFlag *bool) {
defer wgProcess.Done()

var suddenShutDown bool = false
epochBatch := pgx.Batch{}
log.Info("Launching Beacon State Pre-Processer")
loop:
for {
// in case the downloads have finished, and there are no more tasks to execute
if (*downloadFinishedFlag && len(s.EpochTaskChan) == 0) || (suddenShutDown && len(s.EpochTaskChan) == 0) {
if *downloadFinishedFlag && len(s.EpochTaskChan) == 0 {
log.Warn("the task channel has been closed, finishing epoch routine")
if epochBatch.Len() == 0 {
log.Debugf("Sending last epoch batch to be stored...")
Expand All @@ -36,7 +35,7 @@ loop:
select {
case <-s.ctx.Done():
log.Info("context has died, closing state processer routine")
suddenShutDown = true
return

case task, ok := <-s.EpochTaskChan:

Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/validatorWorker.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ loop:
wlog.Debugf("Validator group processed, worker freed for next group. Took %f seconds", time.Since(snapshot).Seconds())

case <-s.ctx.Done():
log.Info("context has died, closing state Worker routine")
log.Info("context has died, closing state worker routine")
return
default:
}
Expand Down
1 change: 1 addition & 0 deletions pkg/db/postgresql/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func (p *PostgresDBService) runWriters() {

case <-p.ctx.Done():
wlogWriter.Info("shutdown detected, closing persister")
break loop
default:
}

Expand Down

0 comments on commit de370a8

Please sign in to comment.