mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 05:42:46 +00:00
Deduplicate FS database, EDU persistence table (#1207)
* Deduplicate FS database, add some EDU persistence groundwork * Extend TransactionWriter to use optional existing transaction, use that for FS SQLite database writes * Fix build due to bad keyserver import * Working EDU persistence * gocyclo, unsurprisingly * Remove unused * Update copyright notices
This commit is contained in:
parent
f3c482b078
commit
11a39fe3b5
22 changed files with 1334 additions and 698 deletions
|
@ -1114,7 +1114,7 @@ func (d *Database) StoreNewSendForDeviceMessage(
|
|||
}
|
||||
// Delegate the database write task to the SendToDeviceWriter. It'll guarantee
|
||||
// that we don't lock the table for writes in more than one place.
|
||||
err = d.SendToDeviceWriter.Do(d.DB, func(txn *sql.Tx) error {
|
||||
err = d.SendToDeviceWriter.Do(d.DB, nil, func(txn *sql.Tx) error {
|
||||
return d.AddSendToDeviceEvent(
|
||||
ctx, txn, userID, deviceID, string(j),
|
||||
)
|
||||
|
@ -1179,7 +1179,7 @@ func (d *Database) CleanSendToDeviceUpdates(
|
|||
// If we need to write to the database then we'll ask the SendToDeviceWriter to
|
||||
// do that for us. It'll guarantee that we don't lock the table for writes in
|
||||
// more than one place.
|
||||
err = d.SendToDeviceWriter.Do(d.DB, func(txn *sql.Tx) error {
|
||||
err = d.SendToDeviceWriter.Do(d.DB, nil, func(txn *sql.Tx) error {
|
||||
// Delete any send-to-device messages marked for deletion.
|
||||
if e := d.SendToDevice.DeleteSendToDeviceMessages(ctx, txn, toDelete); e != nil {
|
||||
return fmt.Errorf("d.SendToDevice.DeleteSendToDeviceMessages: %w", e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue