Prevent failed SaveNotification transaction from locking the database
This commit is contained in:
parent
b9e025589e
commit
2731d787c2
@ -9,6 +9,13 @@ import (
|
|||||||
|
|
||||||
func (p Profile) SaveNotification(n Notification) {
|
func (p Profile) SaveNotification(n Notification) {
|
||||||
tx, err := p.DB.Beginx()
|
tx, err := p.DB.Beginx()
|
||||||
|
defer func() {
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
panic(r) // Re-raise the panic
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user