Skip to content

Commit

Permalink
fix: fix linter errs
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Jul 31, 2024
1 parent 85b145c commit ed65052
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
6 changes: 3 additions & 3 deletions node/pkg/aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ func (n *Aggregator) HandleRoundSyncMessage(ctx context.Context, msg raft.Messag
n.RoundID = roundSyncMessage.RoundID
}

// removes old round data (2 rounds ago)
// n.cleanUpRoundData(roundSyncMessage.RoundID - 2)

var value int64
localAggregateRaw, ok := n.LatestLocalAggregates.Load(n.ID)
if !ok {
Expand All @@ -125,6 +122,9 @@ func (n *Aggregator) HandleRoundSyncMessage(ctx context.Context, msg raft.Messag

n.AggregatorMutex.Lock()
defer n.AggregatorMutex.Unlock()
// run cleanup to prevent memory leak
// removes data 10 rounds ago, approximately 4 seconds old data
n.cleanUpRoundData(roundSyncMessage.RoundID - 10)

n.PreparedLocalAggregates[roundSyncMessage.RoundID] = value
n.SyncedTimes[roundSyncMessage.RoundID] = roundSyncMessage.Timestamp
Expand Down
10 changes: 0 additions & 10 deletions node/pkg/aggregator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ func getLatestRoundId(ctx context.Context, configId int32) (int32, error) {
return result.Round, nil
}

// used for testing
func getProofFromRdb(ctx context.Context, configId int32, round int32) (Proof, error) {
return db.GetObject[Proof](ctx, keys.ProofKey(configId, round))
}

// used for testing
func getLatestGlobalAggregateFromRdb(ctx context.Context, configId int32) (GlobalAggregate, error) {
return db.GetObject[GlobalAggregate](ctx, keys.GlobalAggregateKey(configId))
}

// used for testing
func getProofFromPgs(ctx context.Context, configId int32, round int32) (Proof, error) {
return db.QueryRow[Proof](ctx, "SELECT config_id, round, proof FROM proofs WHERE config_id = @config_id AND round = @round", map[string]any{"config_id": configId, "round": round})
Expand Down
4 changes: 3 additions & 1 deletion node/pkg/dal/api/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ func (c *Hub) castSubmissionData(data *dalcommon.OutgoingSubmissionData, symbol
if _, ok := c.clients[conn][*symbol]; ok {
if err := conn.WriteJSON(*data); err != nil {
log.Error().Err(err).Msg("failed to write message")
go func() { c.unregister <- conn }()
go func(conn *websocket.Conn) {
c.unregister <- conn
}(conn)
}
}
}
Expand Down

0 comments on commit ed65052

Please sign in to comment.