From 0567016b4098890b7da451962d1c7a19384ca1bb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 2 Dec 2017 09:55:53 +0300 Subject: rssutils: PDO --- classes/ccache.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'classes/ccache.php') diff --git a/classes/ccache.php b/classes/ccache.php index 9a6f14f3d..88e28e9e8 100644 --- a/classes/ccache.php +++ b/classes/ccache.php @@ -142,7 +142,13 @@ class CCache { $unread = (int) Feeds::getFeedArticles($feed_id, $is_cat, true, $owner_uid); } - $pdo->beginTransaction(); + $tr_in_progress = false; + + try { + $pdo->beginTransaction(); + } catch (Exception $e) { + $tr_in_progress = true; + } $sth = $pdo->prepare("SELECT feed_id FROM $table WHERE owner_uid = ? AND feed_id = ? LIMIT 1"); @@ -164,7 +170,7 @@ class CCache { $sth->execute([$feed_id, $unread, $owner_uid]); } - $pdo->commit(); + if (!$tr_in_progress) $pdo->commit(); if ($feed_id > 0 && $prev_unread != $unread) { -- cgit v1.2.3