forked from TrueCloudLab/frostfs-node
[#1560] morph/client: Perform RPC switch and restore in one step
Otherwise we could switch infinitely if subscription restore has failed. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
6358f4d746
commit
0ccea802e9
4 changed files with 25 additions and 31 deletions
|
@ -204,16 +204,12 @@ func (c *Client) UnsubscribeAll() error {
|
|||
|
||||
// restoreSubscriptions restores subscriptions according to
|
||||
// cached information about them.
|
||||
func (c *Client) restoreSubscriptions() bool {
|
||||
func (c *Client) restoreSubscriptions(endpoint string) bool {
|
||||
var (
|
||||
err error
|
||||
id string
|
||||
endpoint, _ = c.endpoints.current()
|
||||
err error
|
||||
id string
|
||||
)
|
||||
|
||||
c.switchLock.Lock()
|
||||
defer c.switchLock.Unlock()
|
||||
|
||||
// new block events restoration
|
||||
if c.subscribedToNewBlocks {
|
||||
_, err = c.client.SubscribeForNewBlocks(nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue