Opened 6 years ago

Last modified 4 years ago

#659 new enhancement

mark_entry_failed should possibly rollback session

Reported by: Elrond Owned by:
Priority: major Milestone:
Component: programming Keywords: sql bitesized
Cc: Christopher Allan Webber Parent Tickets:

Description

mark_entry_failed is often called after an exception.
This exception might be an sql exception (it shouldn't, but well, it happens). After an sql exception the session is in a broken state and mark_entry_failed can't do its job and mark the entry failed: If a session is broken, one can't use it for anything, until one cleans it up using .rollback().

So the suggestion is to call Session.rollback() in mark_entry_failed.

Rationale:

  1. If the session is clean: fine.
  2. If the session is broken: better clean it up instead of having a exception on an exception (harder to read).
  3. If someone missed to .save() something, oh well, their fault.

Subtickets

Change History (1)

comment:1 Changed 4 years ago by Elrond

Cc: Christopher Allan Webber added
Keywords: bitesized added

Doing this is nearly bitesized, IMHO.
I am tagging it.

it could be a big task to write a unit test for this. I don't know, if we want one?
If we want, please remove the bitesized tag!

Chris?

Note: See TracTickets for help on using tickets.