Skip to content

Commit

Permalink
fix returning before unlock and add warning log when randomness fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarak Ben Youssef committed Jun 13, 2023
1 parent 3c2f5bd commit 14df98f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions cmd/bootstrap/cmd/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ func constructClusterAssignment(partnerNodes, internalNodes []model.NodeInfo) (f
}

// shuffle both collector lists based on a non-deterministic algorithm
var err error
partners, err = partners.Shuffle()
partners, err := partners.Shuffle()
if err != nil {
log.Fatal().Err(err).Msg("could not shuffle partners")
}
Expand Down
2 changes: 1 addition & 1 deletion engine/execution/computation/query/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ func (e *QueryExecutor) ExecuteScript(
// TODO: this is a temporary measure, we could remove this in the future
if e.logger.Debug().Enabled() {
e.rngLock.Lock()
defer e.rngLock.Unlock()
trackerID, err := rand.Uint32()
if err != nil {
return nil, fmt.Errorf("failed to generate trackerID: %w", err)
}
e.rngLock.Unlock()

trackedLogger := e.logger.With().Hex("script_hex", script).Uint32("trackerID", trackerID).Logger()
trackedLogger.Debug().Msg("script is sent for execution")
Expand Down
1 change: 1 addition & 0 deletions storage/badger/cleaner.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (c *Cleaner) nextWaitDuration() time.Duration {
// In this specific case, `utils/rand` only errors if the system randomness fails
// which is a symptom of a wider failure. Many other node components would catch such
// a failure.
c.log.Warn().Msg("jitter is zero beacuse system randomness has failed")
jitter = 0
}
return time.Duration(c.interval.Nanoseconds() + int64(jitter))
Expand Down

0 comments on commit 14df98f

Please sign in to comment.