mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-28 16:00:37 +01:00
more timeout
This commit is contained in:
1 parent
1c21527179
commit
4a2642e54d
1 file changed
+11
-6
@@ -307,13 +307,18 @@ func (h *Handler) HandleConn(ctx context.Context, conn net.Conn) error {
|
||||
|
||||
// Start a timeout goroutine that will force completion after 1 second
|
||||
go func() {
|
||||
time.Sleep(1 * time.Second)
|
||||
select {
|
||||
case done <- true:
|
||||
fmt.Printf("DEBUG: [%s] Force timeout after 1 second, closing connection\n", connectionID)
|
||||
finalErr = fmt.Errorf("force timeout")
|
||||
default:
|
||||
// Already completed
|
||||
case <-time.After(1 * time.Second):
|
||||
select {
|
||||
case done <- true:
|
||||
fmt.Printf("DEBUG: [%s] Force timeout after 1 second, closing connection\n", connectionID)
|
||||
finalErr = fmt.Errorf("force timeout")
|
||||
default:
|
||||
// Already completed
|
||||
}
|
||||
case <-done:
|
||||
// Operation completed, exit timeout goroutine
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in new issue
Block a user