Skip to content

Commit

Permalink
Buck review updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
martonp committed Aug 12, 2024
1 parent 72df9f8 commit 9760df9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions client/mm/mm_arb_market_maker.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ func (a *arbMarketMaker) registerFeeGap() {
}

func (a *arbMarketMaker) botLoop(ctx context.Context) (*sync.WaitGroup, error) {

book, bookFeed, err := a.core.SyncBook(a.host, a.baseID, a.quoteID)
if err != nil {
return nil, fmt.Errorf("failed to sync book: %v", err)
Expand All @@ -431,6 +430,7 @@ func (a *arbMarketMaker) botLoop(ctx context.Context) (*sync.WaitGroup, error) {

err = a.cex.SubscribeMarket(ctx, a.baseID, a.quoteID)
if err != nil {
bookFeed.Close()
return nil, fmt.Errorf("failed to subscribe to cex market: %v", err)
}

Expand All @@ -440,6 +440,7 @@ func (a *arbMarketMaker) botLoop(ctx context.Context) (*sync.WaitGroup, error) {
wg.Add(1)
go func() {
defer wg.Done()
defer bookFeed.Close()
for {
select {
case ni := <-bookFeed.Next():
Expand All @@ -448,7 +449,6 @@ func (a *arbMarketMaker) botLoop(ctx context.Context) (*sync.WaitGroup, error) {
a.rebalance(epoch.Current)
}
case <-ctx.Done():
bookFeed.Close()
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/mm/mm_basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ func (m *basicMarketMaker) botLoop(ctx context.Context) (*sync.WaitGroup, error)
wg.Add(1)
go func() {
defer wg.Done()
defer bookFeed.Close()
for {
select {
case ni := <-bookFeed.Next():
Expand All @@ -395,7 +396,6 @@ func (m *basicMarketMaker) botLoop(ctx context.Context) (*sync.WaitGroup, error)
m.rebalance(epoch.Current)
}
case <-ctx.Done():
bookFeed.Close()
return
}
}
Expand Down
3 changes: 2 additions & 1 deletion client/mm/mm_simple_arb.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ func (a *simpleArbMarketMaker) botLoop(ctx context.Context) (*sync.WaitGroup, er

err = a.cex.SubscribeMarket(ctx, a.baseID, a.quoteID)
if err != nil {
bookFeed.Close()
return nil, fmt.Errorf("failed to subscribe to cex market: %v", err)
}

Expand All @@ -457,6 +458,7 @@ func (a *simpleArbMarketMaker) botLoop(ctx context.Context) (*sync.WaitGroup, er
wg.Add(1)
go func() {
defer wg.Done()
defer bookFeed.Close()
for {
select {
case ni := <-bookFeed.Next():
Expand All @@ -465,7 +467,6 @@ func (a *simpleArbMarketMaker) botLoop(ctx context.Context) (*sync.WaitGroup, er
a.rebalance(epoch.Current)
}
case <-ctx.Done():
bookFeed.Close()
return
}
}
Expand Down

0 comments on commit 9760df9

Please sign in to comment.