Fix possible "Database is locked" issue

This commit is contained in:
Till Faelligen 2022-09-26 10:45:35 +02:00
parent 8d64c24b23
commit 3c416517b0
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -777,7 +777,7 @@ func (d *Database) GetPushers(
func (d *Database) RemovePusher( func (d *Database) RemovePusher(
ctx context.Context, appid, pushkey, localpart string, ctx context.Context, appid, pushkey, localpart string,
) error { ) error {
return d.Writer.Do(nil, nil, func(txn *sql.Tx) error { return d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
err := d.Pushers.DeletePusher(ctx, txn, appid, pushkey, localpart) err := d.Pushers.DeletePusher(ctx, txn, appid, pushkey, localpart)
if err == sql.ErrNoRows { if err == sql.ErrNoRows {
return nil return nil
@ -792,7 +792,7 @@ func (d *Database) RemovePusher(
func (d *Database) RemovePushers( func (d *Database) RemovePushers(
ctx context.Context, appid, pushkey string, ctx context.Context, appid, pushkey string,
) error { ) error {
return d.Writer.Do(nil, nil, func(txn *sql.Tx) error { return d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
return d.Pushers.DeletePushers(ctx, txn, appid, pushkey) return d.Pushers.DeletePushers(ctx, txn, appid, pushkey)
}) })
} }