From 1410f3b051ccfd53be4ce472d169b4569261280a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Mon, 14 Jul 2025 09:47:41 +0200 Subject: [PATCH] more fine grained transactions in EGG:RemoteSource:update --- www/extern/egg/RemoteSource.php | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/www/extern/egg/RemoteSource.php b/www/extern/egg/RemoteSource.php index 62fc0a0..6c0c306 100644 --- a/www/extern/egg/RemoteSource.php +++ b/www/extern/egg/RemoteSource.php @@ -57,40 +57,40 @@ abstract class StandardGitConnection implements IRemoteSource foreach ($repos as $repo) { - $db->beginTransaction(); - { - $branches = $this->listAndUpdateBranches($db, $repo); - $db->setUpdateDateOnRepository($repo); + $branches = $this->listAndUpdateBranches($db, $repo); + $this->logger->proclog("Found " . count($branches) . " nin Repo: [" . $repo->Name . "]"); - $repo_changed = false; - foreach ($branches as $branch) - { - if ($branch->HeadFromAPI === $branch->Head) - { - $db->setUpdateDateOnBranch($branch); - $this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] is up to date"); - continue; - } + foreach ($branches as $branch) + { - $updateCount = $this->listAndUpdateCommits($db, $repo, $branch); - $db->setUpdateDateOnBranch($branch); - if ($updateCount === 0) - { - $this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] has no new commits"); - continue; - } + $db->beginTransaction(); + { + if ($branch->HeadFromAPI === $branch->Head) + { + $db->setUpdateDateOnBranch($branch); + $this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] is up to date"); + continue; + } - $this->logger->proclog("Found " . $updateCount . " new commits in Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "]"); + $updateCount = $this->listAndUpdateCommits($db, $repo, $branch); + $db->setUpdateDateOnBranch($branch); + if ($updateCount === 0) + { + $this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] has no new commits"); + continue; + } - $repo_changed = true; - $db->setChangeDateOnBranch($branch); - } + $this->logger->proclog("Found " . $updateCount . " new commits in Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "]"); - if ($repo_changed) $db->setChangeDateOnRepository($repo); - if ($repo_changed) $anyChanged = true; - } + $anyChanged = true; - $db->commitTransaction(); + $db->setChangeDateOnBranch($branch); + $db->setChangeDateOnRepository($repo); + $db->setUpdateDateOnRepository($repo); + } + $db->commitTransaction(); + + } } if ($anyChanged)