Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jayy04 committed Mar 5, 2024
1 parent f25d8c7 commit 414c5be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions protocol/streaming/grpc/grpc_streaming_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type GrpcStreamingManagerImpl struct {

// orderbookSubscriptions maps subscription IDs to their respective orderbook subscriptions.
orderbookSubscriptions map[uint32]*OrderbookSubscription
nextId uint32
nextSubscriptionId uint32
}

// OrderbookSubscription represents a active subscription to the orderbook updates stream.
Expand Down Expand Up @@ -59,8 +59,8 @@ func (sm *GrpcStreamingManagerImpl) Subscribe(
sm.Lock()
defer sm.Unlock()

sm.orderbookSubscriptions[sm.nextId] = subscription
sm.nextId++
sm.orderbookSubscriptions[sm.nextSubscriptionId] = subscription
sm.nextSubscriptionId++

return nil
}
Expand Down Expand Up @@ -112,6 +112,7 @@ func (sm *GrpcStreamingManagerImpl) SendOrderbookUpdates(
}

// Clean up subscriptions that have been closed.
// If a Send update has failed for any clob pair id, the whole subscription will be removed.
for _, id := range idsToRemove {
delete(sm.orderbookSubscriptions, id)
}
Expand Down
1 change: 1 addition & 0 deletions protocol/x/clob/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ var (
"Subaccount cannot open more orders due to equity tier limit.",
)

// GrpcStreamingManager errors.
ErrGrpcStreamingManagerNotEnabled = errorsmod.Register(
ModuleName,
11000,
Expand Down

0 comments on commit 414c5be

Please sign in to comment.