From: Brandon L. Black Date: Thu, 10 May 2007 21:13:14 +0000 (+0000) Subject: docs about side-effects in txn_do coderef X-Git-Tag: v0.08010~150^2~76 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6500d50ffcc63b544cf54f5ea1e43dbff9dd1151;p=dbsrgits%2FDBIx-Class.git docs about side-effects in txn_do coderef --- diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index 9a58b94..3369069 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -169,6 +169,15 @@ In a nested transaction (calling txn_do() from within a txn_do() coderef) only the outermost transaction will issue a L, and txn_do() can be called in void, scalar and list context and it will behave as expected. +Please note that all of the code in your coderef, including non-DBIx::Class +code, is part of a transaction. This transaction may fail out halfway, or +it may get partially double-executed (in the case that our DB connection +failed halfway through the transaction, in which case we reconnect and +restart the txn). Therefore it is best that any side-effects in your coderef +are idempotent (that is, can be re-executed multiple times and get the +same result), and that you check up on your side-effects in the case of +transaction failure. + =cut sub txn_do {