Author: Paolo Lulli <paolo@lulli.net>
Fix search bug
client/main.go | 7 +++++--
diff --git a/client/main.go b/client/main.go index 847ef7c2c1b81bc03a0c454feeddf50e5bc0c1f9..38dfbeeca1f7a3715d224f4ac7b12ac4c1152a7b 100644 --- a/client/main.go +++ b/client/main.go @@ -25,6 +25,7 @@ type YatsClient struct { config config.ClientConfiguration } +// MaxPageSize Server returns pages of max 100 results var MaxPageSize = 100 func main() { @@ -194,10 +195,12 @@ os.Exit(1) } metricListModel, maxpage, _ := responseToMetricArray(listResponse) + //fmt.Printf("maxpage : %s, fromTimeStamp: %s, toTimeStamp: %s", maxpage, fromTimestamp, toTimestamp) var composedList []MetricModel composedList = append(composedList, metricListModel...) - for continueSearching(len(metricListModel), maxpage, toTimestamp) { + for continueSearching(len(metricListModel), maxpage/1000, toTimestamp) { + //fmt.Printf("maxpage : %s, toTimeStamp: %s", maxpage, toTimestamp) listResponse, _ = yatsClient.MetricList(*sourceOption, *listMetrics, maxpage/1000, toTimestamp) metricListModel, maxpage, _ = responseToMetricArray(listResponse) composedList = append(composedList, metricListModel...) @@ -291,6 +294,7 @@ func responseToMetricArray(listResponse string) ([]MetricModel, int64, bool) { dataJson, errDataPortion := getDataJson(listResponse) maxpage := getMaxpage(listResponse) + //fmt.Println("maxpage:", maxpage) if errDataPortion { fmt.Printf("Could not parse data attribute: %v", errDataPortion) return nil, 0, true @@ -332,7 +336,6 @@ //fmt.Printf("DEBUG::false 0\n") return true } if toTimestamp > maxpage { - //fmt.Printf("DEBUG::false 1\n") return true } //fmt.Printf("DEBUG::true\n")