avoid close 'nil' panics if any (#18890)

brings a generic implementation that
prints a stack trace for 'nil' channel
closes(), if not safely closes it.
This commit is contained in:
Harshavardhana
2024-01-28 10:04:17 -08:00
committed by GitHub
parent 38de8e6936
commit 1d3bd02089
47 changed files with 150 additions and 104 deletions

View File

@@ -24,6 +24,7 @@ import (
"strings"
"time"
xioutil "github.com/minio/minio/internal/ioutil"
xnet "github.com/minio/pkg/v2/net"
)
@@ -65,7 +66,7 @@ func replayItems[I any](store Store[I], doneCh <-chan struct{}, log logger, id s
keyCh := make(chan Key)
go func() {
defer close(keyCh)
defer xioutil.SafeClose(keyCh)
retryTicker := time.NewTicker(retryInterval)
defer retryTicker.Stop()