improvement: explicitly rollback transaction on duplicate event

This commit is contained in:
Greg Heartsfield 2022-12-20 13:23:04 -06:00
parent cd1557787b
commit dc11d9a619

View File

@ -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.