[#1] mclock: Use time.Duration
for idle timeout
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
47559a8d16
commit
f1cb5b40d5
3 changed files with 10 additions and 9 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"errors"
|
||||
"math"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -74,11 +75,11 @@ type MClock struct {
|
|||
// waitLimit maximum allowed count of waiting requests
|
||||
// for tags specified by tagInfo. The value of idleTimeout defines
|
||||
// the difference between the current time and the time of
|
||||
// the previous request in seconds, at which the tag considered idle.
|
||||
// the previous request, at which the tag considered idle.
|
||||
// If idleTimeout is negative, it means that there is no idle tags allowed.
|
||||
// If waitLimit equals zero, it means that there is no limit on the
|
||||
// number of waiting requests.
|
||||
func NewMClock(runLimit, waitLimit uint64, tagInfo map[string]TagInfo, idleTimeout float64) (*MClock, error) {
|
||||
func NewMClock(runLimit, waitLimit uint64, tagInfo map[string]TagInfo, idleTimeout time.Duration) (*MClock, error) {
|
||||
if err := validateParams(runLimit, tagInfo); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -86,7 +87,7 @@ func NewMClock(runLimit, waitLimit uint64, tagInfo map[string]TagInfo, idleTimeo
|
|||
runLimit: runLimit,
|
||||
waitLimit: int(waitLimit),
|
||||
clock: newSystemClock(),
|
||||
idleTimeout: idleTimeout,
|
||||
idleTimeout: idleTimeout.Seconds(),
|
||||
tagInfo: tagInfo,
|
||||
|
||||
reservationQueue: &queue{},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue