Skip to content

Commit 89a1254

Browse files
Update pkg/rabbitmqamqp/entities.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent f6eefd0 commit 89a1254

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

pkg/rabbitmqamqp/entities.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,17 @@ func durationToMaxAge(d time.Duration) string {
477477
return fmt.Sprintf("%d%s", d/u.size, u.suffix)
478478
}
479479
}
480+
// Fallback: round up to whole seconds for positive durations, enforcing a minimum of 1s.
481+
if d > 0 {
482+
secs := int64(d / time.Second)
483+
if d%time.Second != 0 {
484+
secs++
485+
}
486+
if secs < 1 {
487+
secs = 1
488+
}
489+
return fmt.Sprintf("%ds", secs)
490+
}
480491
return fmt.Sprintf("%ds", int64(d.Seconds()))
481492
}
482493

0 commit comments

Comments
 (0)