Skip to content

Commit

Permalink
remove unnecessary rlock
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsc committed Mar 4, 2024
1 parent 966e089 commit 145772a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions backend/pkg/api/services/service_slot_viz.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ func StartSlotVizDataService() {

func updateSlotVizData() error {
var dutiesInfo *SyncData
currentDataMutex.RLock()
if currentDutiesInfo == nil {
dutiesInfo = initDutiesInfo()
} else {
dutiesInfo = copyAndCleanDutiesInfo()
}
currentDataMutex.RUnlock()

var validatorDutiesInfo []types.ValidatorDutyInfo

// create waiting group for concurrency
gOuter := &errgroup.Group{}

gOuter.SetLimit(3)

// Get the fulfilled duties
gOuter.Go(func() error {
startTime := time.Now()
Expand All @@ -75,11 +75,9 @@ func updateSlotVizData() error {

// if we have fetched epoch assignments before
// dont load for this epoch again
currentDataMutex.RLock()
if currentDutiesInfo != nil && currentDutiesInfo.AssignmentsFetchedForEpoch > 0 {
minEpoch = currentDutiesInfo.AssignmentsFetchedForEpoch + 1
}
currentDataMutex.RUnlock()

maxEpoch := headEpoch + 1

Expand Down

0 comments on commit 145772a

Please sign in to comment.