Exemplo n.º 1
0
 public function _indexForSearch()
 {
     if (SV_DeadlockAvoidance_DataWriter::registerPostTransactionClosure(function () {
         parent::_indexForSearch();
     })) {
         return;
     }
     parent::_indexForSearch();
 }
Exemplo n.º 2
0
 protected function _postSaveAfterTransaction()
 {
     if (SV_DeadlockAvoidance_DataWriter::registerPostTransactionClosure(function () {
         parent::_postSaveAfterTransaction();
     })) {
         return;
     }
     parent::_postSaveAfterTransaction();
 }
Exemplo n.º 3
0
 public function sendAlertsOnReportRejection(array $report, $comment = '')
 {
     if (SV_DeadlockAvoidance_DataWriter::registerPostTransactionClosure(function () use($report, $comment) {
         parent::sendAlertsOnReportRejection($report, $comment);
     })) {
         return;
     }
     parent::sendAlertsOnReportRejection($report, $comment);
 }
Exemplo n.º 4
0
 public function deleteAlerts($contentType, $contentId, $userId = null, $action = null)
 {
     if (SV_DeadlockAvoidance_DataWriter::registerPostTransactionClosure(function () use($contentType, $contentId, $userId, $action) {
         parent::deleteAlerts($contentType, $contentId, $userId, $action);
     })) {
         return;
     }
     parent::deleteAlerts($contentType, $contentId, $userId, $action);
 }
 public function rebuildUnreadConversationCountForUser($userId)
 {
     if (SV_DeadlockAvoidance_DataWriter::registerPostTransactionClosure(function () use($userId) {
         XenForo_Db::beginTransaction();
         parent::rebuildUnreadConversationCountForUser($userId);
         XenForo_Db::commit();
     })) {
         return;
     }
     parent::rebuildUnreadConversationCountForUser($userId);
 }
Exemplo n.º 6
0
 public function mergePosts(array $posts, array $threads, $targetPostId, $newMessage, $options = array())
 {
     // hoist bits out of the mergePosts Transaction
     SV_DeadlockAvoidance_DataWriter::enterTransaction();
     $ret = false;
     try {
         $ret = parent::mergePosts($posts, $threads, $targetPostId, $newMessage, $options);
     } finally {
         SV_DeadlockAvoidance_DataWriter::exitTransaction($ret);
     }
     return $ret;
 }
Exemplo n.º 7
0
 public static function exitTransaction($executePostTransaction)
 {
     self::$transactionCount -= 1;
     if (self::$transactionCount <= 0) {
         self::$transactionCount = 0;
         $postSaveAfterTransactionList = array_reverse(self::$postSaveAfterTransactionList);
         self::$postSaveAfterTransactionList = array();
         if ($executePostTransaction) {
             foreach ($postSaveAfterTransactionList as $postSaveAfterTransaction) {
                 $postSaveAfterTransaction();
             }
         }
     }
 }
Exemplo n.º 8
0
 public function likeContent($contentType, $contentId, $contentUserId, $likeUserId = null, $likeDate = null)
 {
     // hoist bits out of the Like Transaction
     SV_DeadlockAvoidance_DataWriter::enterTransaction();
     $ret = false;
     try {
         $ret = parent::likeContent($contentType, $contentId, $contentUserId, $likeUserId, $likeDate);
     } catch (Zend_Db_Statement_Mysqli_Exception $e) {
         SV_DeadlockAvoidance_DataWriter::exitTransaction(false);
         @XenForo_Db::rollbackAll();
         // something went wrong, retry
         if (stripos($e->getMessage(), "Deadlock found when trying to get lock; try restarting transaction") !== false) {
             SV_DeadlockAvoidance_DataWriter::enterTransaction();
             $ret = parent::likeContent($contentType, $contentId, $contentUserId, $likeUserId, $likeDate);
         } else {
             throw $e;
         }
     } finally {
         SV_DeadlockAvoidance_DataWriter::exitTransaction($ret);
     }
     return $ret;
 }