mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
Cleanup
This commit is contained in:
@ -95,7 +95,10 @@ func (cn *Conn) deadline(ctx context.Context, timeout time.Duration) time.Time {
|
||||
if timeout == 0 {
|
||||
return deadline
|
||||
}
|
||||
return minNonzeroTime(deadline, tm)
|
||||
if deadline.Before(tm) {
|
||||
return deadline
|
||||
}
|
||||
return tm
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,13 +108,3 @@ func (cn *Conn) deadline(ctx context.Context, timeout time.Duration) time.Time {
|
||||
|
||||
return noDeadline
|
||||
}
|
||||
|
||||
func minNonzeroTime(a, b time.Time) time.Time {
|
||||
if a.IsZero() {
|
||||
return b
|
||||
}
|
||||
if b.IsZero() || a.Before(b) {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
Reference in New Issue
Block a user