mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-29 08:18:27 +00:00
Tweaks
This commit is contained in:
parent
9f4ffe4c81
commit
8e527b55e5
1 changed files with 2 additions and 6 deletions
|
@ -83,23 +83,19 @@ func UpStateBlocksRefactor(tx *sql.Tx) error {
|
||||||
var newblocks []types.StateBlockNID
|
var newblocks []types.StateBlockNID
|
||||||
for _, block := range blocks {
|
for _, block := range blocks {
|
||||||
if err = func() error {
|
if err = func() error {
|
||||||
blockrows, berr := tx.Query(`SELECT event_nid FROM _roomserver_state_block WHERE state_block_nid = $1`, block)
|
blockrows, berr := tx.Query(`SELECT event_nid FROM _roomserver_state_block WHERE state_block_nid = $1`, int64(block))
|
||||||
if berr != nil {
|
if berr != nil {
|
||||||
return fmt.Errorf("tx.Query (event nids from old block): %w", berr)
|
return fmt.Errorf("tx.Query (event nids from old block): %w", berr)
|
||||||
}
|
}
|
||||||
defer internal.CloseAndLogIfError(context.TODO(), blockrows, "rows.close() failed")
|
defer internal.CloseAndLogIfError(context.TODO(), blockrows, "rows.close() failed")
|
||||||
events := types.EventNIDs{}
|
events := types.EventNIDs{}
|
||||||
var eventsarray pq.Int64Array
|
|
||||||
for blockrows.Next() {
|
for blockrows.Next() {
|
||||||
var event types.EventNID
|
var event types.EventNID
|
||||||
if err = blockrows.Scan(&event); err != nil {
|
if err = blockrows.Scan(&event); err != nil {
|
||||||
return fmt.Errorf("rows.Scan: %w", err)
|
return fmt.Errorf("rows.Scan (event nids from old block): %w", err)
|
||||||
}
|
}
|
||||||
events = append(events, event)
|
events = append(events, event)
|
||||||
}
|
}
|
||||||
for _, e := range eventsarray {
|
|
||||||
events = append(events, types.EventNID(e))
|
|
||||||
}
|
|
||||||
events = events[:util.SortAndUnique(events)]
|
events = events[:util.SortAndUnique(events)]
|
||||||
|
|
||||||
var blocknid types.StateBlockNID
|
var blocknid types.StateBlockNID
|
||||||
|
|
Loading…
Reference in a new issue