[#2080] morph: Close morph clients

Could be related to "websocket users limit reached" on the `neo-go` server
side when an SN/IR is rebooting repeatedly.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-11-21 19:13:00 +03:00 committed by fyrchik
parent 3d0768a1d3
commit c01d4ecb50
3 changed files with 9 additions and 0 deletions

View file

@ -153,6 +153,12 @@ func (c *Client) newCli(endpoint string) (*rpcclient.WSClient, *actor.Actor, err
return nil, nil, fmt.Errorf("WS client creation: %w", err)
}
defer func() {
if err != nil {
cli.Close()
}
}()
err = cli.Init()
if err != nil {
return nil, nil, fmt.Errorf("WS client initialization: %w", err)