NOISSUE - Remove messages limit in influxdb-reader (#968)
* NOISSUE - Remove messages limit in influxdb-reader Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com> * Rm too large limit test Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
This commit is contained in:
parent
6da650645f
commit
87dd91e328
|
@ -14,10 +14,7 @@ import (
|
|||
"github.com/mainflux/mainflux/transformers/senml"
|
||||
)
|
||||
|
||||
const (
|
||||
maxLimit = 100
|
||||
countCol = "count"
|
||||
)
|
||||
const countCol = "count"
|
||||
|
||||
var _ readers.MessageRepository = (*influxRepository)(nil)
|
||||
|
||||
|
@ -35,10 +32,6 @@ func New(client influxdata.Client, database string) readers.MessageRepository {
|
|||
}
|
||||
|
||||
func (repo *influxRepository) ReadAll(chanID string, offset, limit uint64, query map[string]string) (readers.MessagesPage, error) {
|
||||
if limit > maxLimit {
|
||||
limit = maxLimit
|
||||
}
|
||||
|
||||
condition := fmtCondition(chanID, query)
|
||||
cmd := fmt.Sprintf(`SELECT * FROM messages WHERE %s ORDER BY time DESC LIMIT %d OFFSET %d`, condition, limit, offset)
|
||||
q := influxdata.Query{
|
||||
|
|
|
@ -110,17 +110,6 @@ func TestReadAll(t *testing.T) {
|
|||
Messages: messages[0:10],
|
||||
},
|
||||
},
|
||||
"read message page for too large limit": {
|
||||
chanID: chanID,
|
||||
offset: 0,
|
||||
limit: 101,
|
||||
page: readers.MessagesPage{
|
||||
Total: msgsNum,
|
||||
Offset: 0,
|
||||
Limit: 101,
|
||||
Messages: messages[0:100],
|
||||
},
|
||||
},
|
||||
"read message page for non-existent channel": {
|
||||
chanID: "2",
|
||||
offset: 0,
|
||||
|
|
Loading…
Reference in New Issue