diff --git a/info/v1/container.go b/info/v1/container.go index 1a3449b908..53b8b5d21f 100644 --- a/info/v1/container.go +++ b/info/v1/container.go @@ -91,7 +91,6 @@ func (self ContainerReferenceSlice) Less(i, j int) bool { return self[i].Name < // It specifies how much data users want to get about a container type ContainerInfoRequest struct { // Max number of stats to return. Specify -1 for all stats currently available. - // If start and end time are specified this limit is ignored. // Default: 60 NumStats int `json:"num_stats,omitempty"` diff --git a/utils/timed_store.go b/utils/timed_store.go index 70c310d321..372ff095f5 100644 --- a/utils/timed_store.go +++ b/utils/timed_store.go @@ -84,19 +84,13 @@ func (self *TimedStore) Add(timestamp time.Time, item interface{}) { } // Returns up to maxResult elements in the specified time period (inclusive). -// Results are from first to last. maxResults of -1 means no limit. When first -// and last are specified, maxResults is ignored. +// Results are from first to last. maxResults of -1 means no limit. func (self *TimedStore) InTimeRange(start, end time.Time, maxResults int) []interface{} { // No stats, return empty. if len(self.buffer) == 0 { return []interface{}{} } - // Return all results in a time range if specified. - if !start.IsZero() && !end.IsZero() { - maxResults = -1 - } - var startIndex int if start.IsZero() { // None specified, start at the beginning. diff --git a/utils/timed_store_test.go b/utils/timed_store_test.go index 76b777820c..6daa653b4d 100644 --- a/utils/timed_store_test.go +++ b/utils/timed_store_test.go @@ -144,8 +144,8 @@ func TestInTimeRange(t *testing.T) { expectElements(t, sb.InTimeRange(createTime(3), createTime(5), 10), []int{3, 4}) assert.Empty(sb.InTimeRange(createTime(5), createTime(5), 10)) - // Start and end time ignores maxResults. - expectElements(t, sb.InTimeRange(createTime(1), createTime(5), 1), []int{1, 2, 3, 4}) + // Start and end time does't ignore maxResults. + expectElements(t, sb.InTimeRange(createTime(1), createTime(5), 1), []int{4}) // No start time. expectElements(t, sb.InTimeRange(empty, createTime(5), 10), []int{1, 2, 3, 4})