Commit 1e55d36b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent aa963178
...@@ -354,19 +354,19 @@ func (node *_MasteredNode) WithState(f func(cs *xneo.ClusterState) error) { ...@@ -354,19 +354,19 @@ func (node *_MasteredNode) WithState(f func(cs *xneo.ClusterState) error) {
// The cluster state is guaranteed not to change during f run. // The cluster state is guaranteed not to change during f run.
func (node *_MasteredNode) WithOperationalState(ctx context.Context, f func(mlink *neonet.NodeLink, s *xneo.State) error) error { func (node *_MasteredNode) WithOperationalState(ctx context.Context, f func(mlink *neonet.NodeLink, s *xneo.State) error) error {
for { for {
done := false var err error
var waitReady chan struct{}
node.WithState(func(s *xneo.State) { node.WithState(func(s *xneo.State) {
if !s.operational { if !s.operational {
ready = node.opReady waitReady = node.opReady
return return
} }
//fmt.Printf("withOperation -> ready\n"); //fmt.Printf("withOperation -> ready\n");
done = true
err = f(/*XXX -> s.mlink ?*/node.mlink, s) err = f(/*XXX -> s.mlink ?*/node.mlink, s)
}) })
if done { if waitReady == nil {
return err return err
} }
...@@ -386,7 +386,7 @@ func (node *_MasteredNode) WithOperationalState(ctx context.Context, f func(mlin ...@@ -386,7 +386,7 @@ func (node *_MasteredNode) WithOperationalState(ctx context.Context, f func(mlin
case <-ctx.Done(): case <-ctx.Done():
return fmt.Errorf("wait operational: %w", ctx.Err()) return fmt.Errorf("wait operational: %w", ctx.Err())
case <-ready: case <-waitReady:
// ok - try to relock and read again. // ok - try to relock and read again.
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment