I have a block of code that interacts with an external web service and
writes the results of its interaction to the database. This code is
sometimes called from within a Sequel transaction block. It is
critical that the results of the web service interaction be committed
to the database even if the outer transaction is rolled back.
A savepoint is not an option because I want all work performed in the
outer transaction to be rolled back in the event of an exception or
explicit rollback at any point before or after the web service code is
called.
I got the behavior I want by running the independent transaction in a
separate thread but I think there must be a more efficient way to do
this. Any suggestions?
def parallel_transaction(*args, &block)
result = nil
Thread.new { result = transaction(*args, &block) }.join
result
end
Thanks,
Jay
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.