Tweaks to backfill (#964)

This commit is contained in:
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 var eventJSONs []json.RawMessage
for _, e := range evs { for _, e := range gomatrixserverlib.ReverseTopologicalOrdering(evs) {
eventJSONs = append(eventJSONs, e.JSON()) eventJSONs = append(eventJSONs, e.JSON())
} }

View file

@ -60,7 +60,7 @@ const insertBackwardExtremitySQL = "" +
" ON CONFLICT DO NOTHING" " ON CONFLICT DO NOTHING"
const selectBackwardExtremitiesForRoomSQL = "" + 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 = "" + const deleteBackwardExtremitySQL = "" +
"DELETE FROM syncapi_backward_extremities WHERE room_id = $1 AND prev_event_id = $2" "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" " ON CONFLICT (room_id, event_id, prev_event_id) DO NOTHING"
const selectBackwardExtremitiesForRoomSQL = "" + 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 = "" + const deleteBackwardExtremitySQL = "" +
"DELETE FROM syncapi_backward_extremities WHERE room_id = $1 AND prev_event_id = $2" "DELETE FROM syncapi_backward_extremities WHERE room_id = $1 AND prev_event_id = $2"