Tweaks to backfill (#964)

main
Neil Alexander 2020-04-15 14:39:27 +01:00 committed by GitHub
parent 895a72b6ee
commit 7b3edf4622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -93,7 +93,7 @@ func Backfill(
}
var eventJSONs []json.RawMessage
for _, e := range evs {
for _, e := range gomatrixserverlib.ReverseTopologicalOrdering(evs) {
eventJSONs = append(eventJSONs, e.JSON())
}

View File

@ -60,7 +60,7 @@ const insertBackwardExtremitySQL = "" +
" ON CONFLICT DO NOTHING"
const selectBackwardExtremitiesForRoomSQL = "" +
"SELECT event_id FROM syncapi_backward_extremities WHERE room_id = $1"
"SELECT DISTINCT event_id FROM syncapi_backward_extremities WHERE room_id = $1"
const deleteBackwardExtremitySQL = "" +
"DELETE FROM syncapi_backward_extremities WHERE room_id = $1 AND prev_event_id = $2"

View File

@ -60,7 +60,7 @@ const insertBackwardExtremitySQL = "" +
" ON CONFLICT (room_id, event_id, prev_event_id) DO NOTHING"
const selectBackwardExtremitiesForRoomSQL = "" +
"SELECT event_id FROM syncapi_backward_extremities WHERE room_id = $1"
"SELECT DISTINCT event_id FROM syncapi_backward_extremities WHERE room_id = $1"
const deleteBackwardExtremitySQL = "" +
"DELETE FROM syncapi_backward_extremities WHERE room_id = $1 AND prev_event_id = $2"