S3 Tables: fix gRPC stream loop handling for list operations
- Correctly handle io.EOF to terminate loops gracefully. - Propagate other errors to prevent silent failures. - Ensure all list results are processed effectively.
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@@ -106,7 +107,10 @@ func (h *S3TablesHandler) handleListTableBuckets(w http.ResponseWriter, r *http.
|
||||
for {
|
||||
entry, respErr := resp.Recv()
|
||||
if respErr != nil {
|
||||
break
|
||||
if respErr == io.EOF {
|
||||
break
|
||||
}
|
||||
return respErr
|
||||
}
|
||||
if entry.Entry == nil {
|
||||
continue
|
||||
@@ -219,7 +223,10 @@ func (h *S3TablesHandler) handleDeleteTableBucket(w http.ResponseWriter, r *http
|
||||
for {
|
||||
entry, err := resp.Recv()
|
||||
if err != nil {
|
||||
break
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
return err
|
||||
}
|
||||
if entry.Entry != nil && !strings.HasPrefix(entry.Entry.Name, ".") {
|
||||
hasChildren = true
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -338,7 +339,10 @@ func (h *S3TablesHandler) listTablesInNamespaceWithClient(ctx context.Context, c
|
||||
for {
|
||||
entry, respErr := resp.Recv()
|
||||
if respErr != nil {
|
||||
break
|
||||
if respErr == io.EOF {
|
||||
break
|
||||
}
|
||||
return respErr
|
||||
}
|
||||
if entry.Entry == nil {
|
||||
continue
|
||||
@@ -415,7 +419,10 @@ func (h *S3TablesHandler) listTablesInAllNamespaces(ctx context.Context, filerCl
|
||||
for {
|
||||
entry, respErr := resp.Recv()
|
||||
if respErr != nil {
|
||||
break
|
||||
if respErr == io.EOF {
|
||||
break
|
||||
}
|
||||
return respErr
|
||||
}
|
||||
if entry.Entry == nil {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user