move object channel defer close to goroutine

Signed-off-by: Brian Downs <brian.downs@gmail.com>
This commit is contained in:
Brian Downs 2021-05-18 19:58:30 -07:00
parent 69795277be
commit 8fd180e0d9

View File

@ -1017,12 +1017,13 @@ func (e *ETCD) DeleteSnapshots(ctx context.Context, snapshots []string) error {
}
objectsCh := make(chan minio.ObjectInfo)
defer close(objectsCh)
ctx, cancel := context.WithTimeout(ctx, defaultS3OpTimeout)
defer cancel()
go func() {
defer close(objectsCh)
opts := minio.ListObjectsOptions{
Recursive: true,
}