From 1ce4e4a219a98c5843906b27ed0ef44172fd7a43 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 4 Jan 2023 02:13:20 +0200 Subject: [PATCH] Fix some database transaction bugs --- database/portal.go | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/database/portal.go b/database/portal.go index 107a4b7..d6de78c 100644 --- a/database/portal.go +++ b/database/portal.go @@ -263,12 +263,12 @@ func (portal *Portal) Delete() { portal.log.Warnfln("Failed to commit portal delete transaction: %v", err) } }() - _, err = portal.db.Exec("UPDATE portal SET in_space=false WHERE parent_group=$1", portal.Key.JID) + _, err = txn.Exec("UPDATE portal SET in_space=false WHERE parent_group=$1", portal.Key.JID) if err != nil { portal.log.Warnfln("Failed to mark child groups of %v as not in space: %v", portal.Key.JID, err) return } - _, err = portal.db.Exec("DELETE FROM portal WHERE jid=$1 AND receiver=$2", portal.Key.JID, portal.Key.Receiver) + _, err = txn.Exec("DELETE FROM portal WHERE jid=$1 AND receiver=$2", portal.Key.JID, portal.Key.Receiver) if err != nil { portal.log.Warnfln("Failed to delete %v: %v", portal.Key, err) } diff --git a/go.mod b/go.mod index 480afae..258dd4d 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/prometheus/client_golang v1.14.0 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/tidwall/gjson v1.14.4 - go.mau.fi/whatsmeow v0.0.0-20230101112920-9b93048f5e21 + go.mau.fi/whatsmeow v0.0.0-20230104001256-9d98dc9b5702 golang.org/x/image v0.2.0 golang.org/x/net v0.4.0 google.golang.org/protobuf v1.28.1 diff --git a/go.sum b/go.sum index e1add5e..736d5be 100644 --- a/go.sum +++ b/go.sum @@ -66,8 +66,8 @@ github.com/yuin/goldmark v1.5.3 h1:3HUJmBFbQW9fhQOzMgseU134xfi6hU+mjWywx5Ty+/M= github.com/yuin/goldmark v1.5.3/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mau.fi/libsignal v0.1.0 h1:vAKI/nJ5tMhdzke4cTK1fb0idJzz1JuEIpmjprueC+c= go.mau.fi/libsignal v0.1.0/go.mod h1:R8ovrTezxtUNzCQE5PH30StOQWWeBskBsWE55vMfY9I= -go.mau.fi/whatsmeow v0.0.0-20230101112920-9b93048f5e21 h1:iDNhclPIMzMP2J3RW2d9qn+yjjV7TKt0WkcnRUiFonQ= -go.mau.fi/whatsmeow v0.0.0-20230101112920-9b93048f5e21/go.mod h1:TrdC8N6SnPFxWo5FiMnDIDFuVyfOLzy5dWDaUPNjcHY= +go.mau.fi/whatsmeow v0.0.0-20230104001256-9d98dc9b5702 h1:ZaDXqhk8KODLZCcWza0XLEXavJCZw68YKJ0Rttocrmg= +go.mau.fi/whatsmeow v0.0.0-20230104001256-9d98dc9b5702/go.mod h1:TrdC8N6SnPFxWo5FiMnDIDFuVyfOLzy5dWDaUPNjcHY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=