aboutsummaryrefslogtreecommitdiff
path: root/syncapi/storage/postgres
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-04-27 14:53:11 +0100
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-04-27 15:10:15 +0100
commit655ac3e8fb83e1cb9b670ab420a0f661dc19786e (patch)
treea314520df9bf0a25f9ab6ed7ea0f1e80062dfdff /syncapi/storage/postgres
parent6ee8507955f2b9674649acc928768b1a4d96f7c0 (diff)
Try that again
Diffstat (limited to 'syncapi/storage/postgres')
-rw-r--r--syncapi/storage/postgres/account_data_table.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/syncapi/storage/postgres/account_data_table.go b/syncapi/storage/postgres/account_data_table.go
index 7c0d0303..e9c72058 100644
--- a/syncapi/storage/postgres/account_data_table.go
+++ b/syncapi/storage/postgres/account_data_table.go
@@ -105,7 +105,6 @@ func (s *accountDataStatements) SelectAccountDataInRange(
accountDataEventFilter *gomatrixserverlib.EventFilter,
) (data map[string][]string, pos types.StreamPosition, err error) {
data = make(map[string][]string)
- pos = r.High()
rows, err := s.selectAccountDataInRangeStmt.QueryContext(ctx, userID, r.Low(), r.High(),
pq.StringArray(filterConvertTypeWildcardToSQL(accountDataEventFilter.Types)),
@@ -120,7 +119,6 @@ func (s *accountDataStatements) SelectAccountDataInRange(
var dataType string
var roomID string
var id types.StreamPosition
- var highest types.StreamPosition
for rows.Next() {
if err = rows.Scan(&id, &roomID, &dataType); err != nil {
@@ -132,12 +130,12 @@ func (s *accountDataStatements) SelectAccountDataInRange(
} else {
data[roomID] = []string{dataType}
}
- if id > highest {
- highest = id
+ if id > pos {
+ pos = id
}
}
- if highest < pos {
- pos = highest
+ if pos == 0 {
+ pos = r.High()
}
return data, pos, rows.Err()
}