Remove double stop
This commit is contained in:
parent
8740fb4bbe
commit
b541cf919d
@ -462,6 +462,17 @@ func (n *Ensemble) Start() *Ensemble {
|
||||
require.NoError(n.t, err)
|
||||
|
||||
var rpcShutdownOnce sync.Once
|
||||
var stopOnce sync.Once
|
||||
var stopErr error
|
||||
|
||||
stopFunc := stop
|
||||
stop = func(ctx context.Context) error {
|
||||
stopOnce.Do(func() {
|
||||
stopErr = stopFunc(ctx)
|
||||
})
|
||||
return stopErr
|
||||
}
|
||||
|
||||
// Are we hitting this node through its RPC?
|
||||
if full.options.rpc {
|
||||
withRPC, rpcCloser := fullRpc(n.t, full)
|
||||
@ -470,12 +481,11 @@ func (n *Ensemble) Start() *Ensemble {
|
||||
rpcShutdownOnce.Do(rpcCloser)
|
||||
return stop(ctx)
|
||||
}
|
||||
//n.t.Cleanup(func() { rpcShutdownOnce.Do(rpcCloser) })
|
||||
n.t.Cleanup(func() { rpcShutdownOnce.Do(rpcCloser) })
|
||||
}
|
||||
|
||||
n.t.Cleanup(func() {
|
||||
_ = stop(context.Background())
|
||||
|
||||
})
|
||||
|
||||
n.active.fullnodes = append(n.active.fullnodes, full)
|
||||
|
@ -50,7 +50,6 @@ func fullRpc(t *testing.T, f *TestFullNode) (*TestFullNode, Closer) {
|
||||
|
||||
cl, stop, err := client.NewFullNodeRPCV1(context.Background(), "ws://"+srv.Listener.Addr().String()+"/rpc/v1", nil)
|
||||
require.NoError(t, err)
|
||||
t.Cleanup(stop)
|
||||
f.ListenAddr, f.ListenURL, f.FullNode = maddr, srv.URL, cl
|
||||
|
||||
return f, func() { stop(); rpcCloser() }
|
||||
|
Loading…
Reference in New Issue
Block a user