[Ur] FFI and transactions

Chris Double chris.double at double.co.nz
Sun May 29 07:38:42 EDT 2011


On Sun, May 29, 2011 at 11:30 PM, Marc Weber <marco-oweber at gmx.de> wrote:
> However because urweb may retry any request arbitrarily  often
> I don't know yet which is the best way to run code which cannot be
> undone (such as comitting payments to external apis)

Can you use the NULL rollback callback argument of
uw_register_transactional for this? From the manual:

"To accommodate some stubbornly non-transactional real-world actions
like sending an e-mail message, Ur/Web treats NULL rollback callbacks
specially. When a transaction commits, all commit actions that have
non-NULL rollback actions are tried before any commit actions that
have NULL rollback actions. Thus, if a single execution uses only one
non-transactional action, and if that action never fails partway
through its execution while still causing an observable side effect,
then Ur/Web can maintain the transactional abstraction."

>From what I understand from that, if that callback is being called
then the transaction has reached a point where it won't be rolled
back.

Chris.
-- 
http://www.bluishcoder.co.nz



More information about the Ur mailing list