mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-30 20:57:07 +00:00
fix: improve error messages and channel handling in sendRegistration
- Clarify error message when stream fails before registration sent - Use two-value receive form to properly detect closed channels - Better distinguish between closed channel and nil value scenarios
This commit is contained in:
@@ -637,7 +637,7 @@ func (c *GrpcAdminClient) sendRegistration(worker *types.WorkerData, streamFaile
|
||||
case <-time.After(5 * time.Second):
|
||||
return fmt.Errorf("failed to send registration message: timeout")
|
||||
case <-streamFailed:
|
||||
return fmt.Errorf("stream failed while sending registration")
|
||||
return fmt.Errorf("stream failed before registration message could be sent")
|
||||
}
|
||||
|
||||
// Wait for registration response
|
||||
@@ -647,8 +647,8 @@ func (c *GrpcAdminClient) sendRegistration(worker *types.WorkerData, streamFaile
|
||||
|
||||
for {
|
||||
select {
|
||||
case regResp := <-regWait:
|
||||
if regResp == nil {
|
||||
case regResp, ok := <-regWait:
|
||||
if !ok || regResp == nil {
|
||||
return fmt.Errorf("registration failed: channel closed unexpectedly")
|
||||
}
|
||||
if regResp.Success {
|
||||
|
||||
Reference in New Issue
Block a user