fix(flashnode): modify timeout uint from second to Millisecond when read datanode. #1000061026

Signed-off-by: baihailong <baihailong@oppo.com>
This commit is contained in:
baihailong 2025-04-14 20:02:12 +08:00 committed by zhumingze1108
parent f2365c1319
commit fd2d45ea5a

View File

@ -82,7 +82,7 @@ func extentReadWithRetry(reqPacket *proto.Packet, source *proto.DataSource, afte
break
}
}
if time.Since(startTime) > time.Duration(timeout)*time.Second {
if time.Since(startTime) > time.Duration(timeout)*time.Millisecond {
log.LogWarnf("extentReadWithRetry: retry timeout req(%v) time(%v) hosts(%v) volume(%v) ino(%v) client(%v)",
reqPacket, time.Since(startTime), hosts, volume, ino, clientIP)
break
@ -122,7 +122,7 @@ func readFromDataPartition(addr string, reqPacket *proto.Packet, afterReadFunc c
return
}
if readBytes, err = getReadReply(conn, reqPacket, afterReadFunc, timeout); err != nil {
why = "get reply"
why = fmt.Sprintf("get reply from %v", addr)
return
}
return
@ -162,9 +162,9 @@ func getReadReply(conn *net.TCPConn, reqPacket *proto.Packet, afterReadFunc cach
return readBytes, nil
}
func ReadReplyFromConn(reply *proto.Packet, c net.Conn, timeoutSec int) (err error) {
if timeoutSec != proto.NoReadDeadlineTime {
c.SetReadDeadline(time.Now().Add(time.Second * time.Duration(timeoutSec)))
func ReadReplyFromConn(reply *proto.Packet, c net.Conn, timeout int) (err error) {
if timeout != proto.NoReadDeadlineTime {
c.SetReadDeadline(time.Now().Add(time.Millisecond * time.Duration(timeout)))
} else {
c.SetReadDeadline(time.Time{})
}