GetMaxSessionDuration fix

should return no more than initial call descriptor duration
This commit is contained in:
Radu Ioan Fericean
2014-02-07 19:54:09 +02:00
parent dadf06f3ef
commit 77ea2754cb
4 changed files with 75 additions and 11 deletions

View File

@@ -187,3 +187,11 @@ func ParseDurationWithSecs(durStr string) (time.Duration, error) {
func BalanceKey(tenant, account, direction string) string {
return fmt.Sprintf("%s:%s:%s", direction, tenant, account)
}
// returns the minimum duration between the two
func MinDuration(d1, d2 time.Duration) time.Duration {
if d1 < d2 {
return d1
}
return d2
}