Re: deciding whether to do work in tpc_vote or tpc_finish
Laurence Rowe <[email protected]>
| Newsgroups | gmane.comp.web.zope.devel |
|---|---|
| Message-ID | <[email protected]> |
On 13 June 2010 11:18, Chris Withers <[email protected]> wrote: > Laurence Rowe wrote: >> >> On 8 June 2010 12:59, Chris Withers <[email protected]> wrote: >>> >>> Laurence Rowe wrote: >>>> >>>> it fails you will end up in an inconsistent state whatever. It's just >>>> that with the maildir implementation, it pretty much can't fail as it >>>> is only a rename and that should always succeed. Really, it should >>>> register as an after commit hook instead. >>> >>> How do I do that? >> >> transaction.get().addAfterCommitHook(callable, args, kwargs) > > Hmm, I realised from looking at the code this morning that this won't. > The reason being that there's no equivalent AfterAbortHook where I can abort > the messaging transaction in the event of transaction-package transaction > abort. """ After-commit hook ------------------ Sometimes, applications want to execute code after a transaction is committed or aborted. For example, one might want to launch non transactional code after a successful commit. Or still someone might want to launch asynchronous code after. A post-commit hook is available for such use cases: use addAfterCommitHook(), passing it a callable and arguments. The callable will be called with a Boolean value representing the status of the commit operation as first argument (true if successfull or false iff aborted) preceding its arguments at the start of the commit (but not for substransaction commits). """ http://zope3.pov.lt/trac/browser/transaction/trunk/transaction/_transaction.py Laurence _______________________________________________ Zope-Dev maillist - [email protected] https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )