mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-09 21:29:06 -05:00
improvement: explicitly rollback transaction on duplicate event
This commit is contained in:
parent
cd1557787b
commit
dc11d9a619
|
@ -321,7 +321,8 @@ pub fn write_event(conn: &mut PooledConnection, e: &Event) -> Result<usize> {
|
||||||
)?;
|
)?;
|
||||||
if ins_count == 0 {
|
if ins_count == 0 {
|
||||||
// if the event was a duplicate, no need to insert event or
|
// if the event was a duplicate, no need to insert event or
|
||||||
// pubkey references. This will abort the txn.
|
// pubkey references.
|
||||||
|
tx.rollback().ok();
|
||||||
return Ok(ins_count);
|
return Ok(ins_count);
|
||||||
}
|
}
|
||||||
// remember primary key of the event most recently inserted.
|
// remember primary key of the event most recently inserted.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user