Skip to content

Commit

Permalink
Kraken: Fix RemoveSubscription calls on sub err
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Nov 2, 2023
1 parent 1be835b commit 119daca
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions exchanges/kraken/kraken_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -1222,12 +1222,14 @@ func (k *Kraken) subscribeToChan(c *stream.ChannelSubscription) error {

respRaw, err := conn.SendMessageReturnResponse(r.RequestID, r)
if err != nil {
k.Websocket.RemoveSubscriptions(*c)
return fmt.Errorf("%w Channel: %s Pair: %s Error: %w", stream.ErrSubscriptionFailure, c.Channel, c.Currency, err)
}

if err = k.getErrResp(respRaw); err != nil {
wErr := fmt.Errorf("%w Channel: %s Pair: %s; %w", stream.ErrSubscriptionFailure, c.Channel, c.Currency, err)
k.Websocket.DataHandler <- wErr
k.Websocket.RemoveSubscriptions(*c)
return wErr
}

Expand Down

0 comments on commit 119daca

Please sign in to comment.