make Close() calls idempotent

Previously, few of them resulted in panics when called more than once.
This commit is contained in:
Dmitry Verkhoturov
2023-01-03 01:41:26 -06:00
committed by Umputun
parent 067a8bcb21
commit d7e9be99f9
34 changed files with 298 additions and 97 deletions
@@ -338,6 +338,6 @@ func TestRPC_closeHndl(t *testing.T) {
api := fmt.Sprintf("http://localhost:%d/test", port)
re := engine.RPC{Client: jrpc.Client{API: api, Client: http.Client{Timeout: 1 * time.Second}}}
err := re.Close()
assert.NoError(t, err)
assert.NoError(t, re.Close())
assert.NoError(t, re.Close(), "second call should not result in panic or errors")
}