From 1fad724b951d1f804be03362a855f9d50ab4acc9 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 15 Aug 2024 21:39:33 +0200 Subject: Improve SQL transactions (#6713) To avoid some locks. Fix https://github.com/FreshRSS/FreshRSS/issues/6686 Might be some regressions since https://github.com/FreshRSS/FreshRSS/pull/6632 --- app/Controllers/feedController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 396649701..dbdf858a7 100644 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -800,9 +800,9 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { */ public static function actualizeFeedsAndCommit(?int $feed_id = null, ?string $feed_url = null, ?int $maxFeeds = null, ?SimplePie $simplePiePush = null): array { $entryDAO = FreshRSS_Factory::createEntryDao(); - $entryDAO->beginTransaction(); [$nbUpdatedFeeds, $feed, $nbNewArticles, $feedsCacheToRefresh] = FreshRSS_feed_Controller::actualizeFeeds($feed_id, $feed_url, $maxFeeds, $simplePiePush); if ($nbNewArticles > 0) { + $entryDAO->beginTransaction(); FreshRSS_feed_Controller::commitNewEntries(); } if (count($feedsCacheToRefresh) > 0) { @@ -852,10 +852,10 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { FreshRSS_category_Controller::refreshDynamicOpmls(); } $entryDAO = FreshRSS_Factory::createEntryDao(); - $entryDAO->beginTransaction(); [$nbUpdatedFeeds, $feed, $nbNewArticles, $feedsCacheToRefresh] = self::actualizeFeeds($id, $url, $maxFeeds); if (!$noCommit) { if ($nbNewArticles > 0) { + $entryDAO->beginTransaction(); FreshRSS_feed_Controller::commitNewEntries(); } $feedDAO = FreshRSS_Factory::createFeedDao(); -- cgit v1.2.3