mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 23:48:27 +00:00
Try that again
This commit is contained in:
parent
6ee8507955
commit
655ac3e8fb
2 changed files with 8 additions and 12 deletions
|
@ -105,7 +105,6 @@ func (s *accountDataStatements) SelectAccountDataInRange(
|
||||||
accountDataEventFilter *gomatrixserverlib.EventFilter,
|
accountDataEventFilter *gomatrixserverlib.EventFilter,
|
||||||
) (data map[string][]string, pos types.StreamPosition, err error) {
|
) (data map[string][]string, pos types.StreamPosition, err error) {
|
||||||
data = make(map[string][]string)
|
data = make(map[string][]string)
|
||||||
pos = r.High()
|
|
||||||
|
|
||||||
rows, err := s.selectAccountDataInRangeStmt.QueryContext(ctx, userID, r.Low(), r.High(),
|
rows, err := s.selectAccountDataInRangeStmt.QueryContext(ctx, userID, r.Low(), r.High(),
|
||||||
pq.StringArray(filterConvertTypeWildcardToSQL(accountDataEventFilter.Types)),
|
pq.StringArray(filterConvertTypeWildcardToSQL(accountDataEventFilter.Types)),
|
||||||
|
@ -120,7 +119,6 @@ func (s *accountDataStatements) SelectAccountDataInRange(
|
||||||
var dataType string
|
var dataType string
|
||||||
var roomID string
|
var roomID string
|
||||||
var id types.StreamPosition
|
var id types.StreamPosition
|
||||||
var highest types.StreamPosition
|
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
if err = rows.Scan(&id, &roomID, &dataType); err != nil {
|
if err = rows.Scan(&id, &roomID, &dataType); err != nil {
|
||||||
|
@ -132,12 +130,12 @@ func (s *accountDataStatements) SelectAccountDataInRange(
|
||||||
} else {
|
} else {
|
||||||
data[roomID] = []string{dataType}
|
data[roomID] = []string{dataType}
|
||||||
}
|
}
|
||||||
if id > highest {
|
if id > pos {
|
||||||
highest = id
|
pos = id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if highest < pos {
|
if pos == 0 {
|
||||||
pos = highest
|
pos = r.High()
|
||||||
}
|
}
|
||||||
return data, pos, rows.Err()
|
return data, pos, rows.Err()
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,6 @@ func (s *accountDataStatements) SelectAccountDataInRange(
|
||||||
r types.Range,
|
r types.Range,
|
||||||
filter *gomatrixserverlib.EventFilter,
|
filter *gomatrixserverlib.EventFilter,
|
||||||
) (data map[string][]string, pos types.StreamPosition, err error) {
|
) (data map[string][]string, pos types.StreamPosition, err error) {
|
||||||
pos = r.High()
|
|
||||||
data = make(map[string][]string)
|
data = make(map[string][]string)
|
||||||
stmt, params, err := prepareWithFilters(
|
stmt, params, err := prepareWithFilters(
|
||||||
s.db, nil, selectAccountDataInRangeSQL,
|
s.db, nil, selectAccountDataInRangeSQL,
|
||||||
|
@ -116,7 +115,6 @@ func (s *accountDataStatements) SelectAccountDataInRange(
|
||||||
var dataType string
|
var dataType string
|
||||||
var roomID string
|
var roomID string
|
||||||
var id types.StreamPosition
|
var id types.StreamPosition
|
||||||
var highest types.StreamPosition
|
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
if err = rows.Scan(&id, &roomID, &dataType); err != nil {
|
if err = rows.Scan(&id, &roomID, &dataType); err != nil {
|
||||||
|
@ -128,12 +126,12 @@ func (s *accountDataStatements) SelectAccountDataInRange(
|
||||||
} else {
|
} else {
|
||||||
data[roomID] = []string{dataType}
|
data[roomID] = []string{dataType}
|
||||||
}
|
}
|
||||||
if id > highest {
|
if id > pos {
|
||||||
highest = id
|
pos = id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if highest < pos {
|
if pos == 0 {
|
||||||
pos = highest
|
pos = r.High()
|
||||||
}
|
}
|
||||||
return data, pos, nil
|
return data, pos, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue