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 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)

> Since the data manager I'm working on is for a transcation message sending
> implementation, maybe it should be an after commit thing too?
>
> My other thought was to have it commit the message send in tpc_vote, and
> make sure it sorts before zope.sqlalchemy. That way, if the message send
> fails, the "transaction" will be aborted, and that will include rolling back
> the zope.sqlalchemy session rather than committing it.
>
> Views?

In that case if the sqlalchemy commit fails, you still sent the message.

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 )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.