Commit 55b50754 authored by Geoff Simmons's avatar Geoff Simmons

VSM.AttachTmo() uses time.Truncate().

parent 0de7803a
...@@ -95,16 +95,16 @@ func (v *VSM) Error() string { ...@@ -95,16 +95,16 @@ func (v *VSM) Error() string {
} }
// AttachTmo sets the timeout for attaching to a Varnish instance. If // AttachTmo sets the timeout for attaching to a Varnish instance. If
// the Duration, rounded to seconds toward 0s, is >= 0s, then wait // the Duration, truncated to seconds, is >= 0s, then wait that many
// that many seconds to attach. If the Duration < 0s, wait // seconds to attach. If the Duration < 0s, wait indefinitely. By
// indefinitely. By default, the Varnish default timeout holds (5s in // default, the Varnish default timeout holds (5s in recent Varnish
// recent Varnish versions). // versions).
func (v *VSM) AttachTmo(tmo time.Duration) error { func (v *VSM) AttachTmo(tmo time.Duration) error {
if err := v.checkNil(); err != nil { if err := v.checkNil(); err != nil {
return err return err
} }
arg := "off" arg := "off"
secs := tmo / time.Second secs := tmo.Truncate(time.Second)
if secs >= 0 { if secs >= 0 {
arg = strconv.FormatUint(uint64(secs), 10) arg = strconv.FormatUint(uint64(secs), 10)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment