mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
all: substitute zeroTime with time.Time{}, since this generates more optimal binary code
This commit is contained in:
parent
5aee6eb406
commit
34d14c4940
2 changed files with 3 additions and 7 deletions
|
@ -462,8 +462,6 @@ func (ctx *vmselectRequestCtx) writeUint64(n uint64) error {
|
|||
|
||||
const maxRPCNameSize = 128
|
||||
|
||||
var zeroTime time.Time
|
||||
|
||||
func (s *Server) processVMSelectRequest(ctx *vmselectRequestCtx) error {
|
||||
// Read rpcName
|
||||
// Do not set deadline on reading rpcName, since it may take a
|
||||
|
@ -482,7 +480,7 @@ func (s *Server) processVMSelectRequest(ctx *vmselectRequestCtx) error {
|
|||
return fmt.Errorf("cannot set read deadline for reading request args: %w", err)
|
||||
}
|
||||
defer func() {
|
||||
_ = ctx.bc.SetReadDeadline(zeroTime)
|
||||
_ = ctx.bc.SetReadDeadline(time.Time{})
|
||||
}()
|
||||
|
||||
// Read the timeout for request execution.
|
||||
|
|
|
@ -132,7 +132,7 @@ func writeMessage(c net.Conn, msg string) error {
|
|||
return fmt.Errorf("cannot flush %q to server: %w", msg, err)
|
||||
}
|
||||
}
|
||||
if err := c.SetWriteDeadline(zeroTime); err != nil {
|
||||
if err := c.SetWriteDeadline(time.Time{}); err != nil {
|
||||
return fmt.Errorf("cannot reset write deadline: %w", err)
|
||||
}
|
||||
return nil
|
||||
|
@ -161,10 +161,8 @@ func readData(c net.Conn, dataLen int) ([]byte, error) {
|
|||
if n, err := io.ReadFull(c, data); err != nil {
|
||||
return nil, fmt.Errorf("cannot read message with size %d: %w; read only %d bytes", dataLen, err, n)
|
||||
}
|
||||
if err := c.SetReadDeadline(zeroTime); err != nil {
|
||||
if err := c.SetReadDeadline(time.Time{}); err != nil {
|
||||
return nil, fmt.Errorf("cannot reset read deadline: %w", err)
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
var zeroTime time.Time
|
||||
|
|
Loading…
Reference in a new issue