Last active
July 6, 2016 17:27
-
-
Save SmellyFish/b7ebef7f1b9cb318bd83121d2781a3be to your computer and use it in GitHub Desktop.
Transaction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
$connection->beginTransaction(); | |
$connection->exec($insertQuery, $insertValues); | |
if ($lastProspectId) { | |
$listEmail->setClientType($lastProspectId); | |
$listEmail->save($connection); | |
} | |
$connection->commit(); | |
$queuedSuccessfully = true; | |
} catch (Exception $e) { | |
$connection->rollback(); | |
if (EmailManager::exceptionIndicatesDeadlock($e)) { | |
//retry on deadlock | |
$queueException = $e; | |
} else { | |
//non-deadlock, bail out immediately w/o retrying | |
GraphiteClient::increment('email.failure.queue.nodeadlock'); | |
... | |
throw $e; | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment