more fine grained transactions in EGG:RemoteSource:update
This commit is contained in:
parent
e5c9b1c2a0
commit
d57682a924
24
www/extern/egg/RemoteSource.php
vendored
24
www/extern/egg/RemoteSource.php
vendored
@ -56,19 +56,20 @@ abstract class StandardGitConnection implements IRemoteSource
|
|||||||
$anyChanged = false;
|
$anyChanged = false;
|
||||||
|
|
||||||
foreach ($repos as $repo)
|
foreach ($repos as $repo)
|
||||||
{
|
|
||||||
$db->beginTransaction();
|
|
||||||
{
|
{
|
||||||
$branches = $this->listAndUpdateBranches($db, $repo);
|
$branches = $this->listAndUpdateBranches($db, $repo);
|
||||||
$db->setUpdateDateOnRepository($repo);
|
$this->logger->proclog("Found " . count($branches) . " nin Repo: [" . $repo->Name . "]");
|
||||||
|
|
||||||
$repo_changed = false;
|
|
||||||
foreach ($branches as $branch)
|
foreach ($branches as $branch)
|
||||||
|
{
|
||||||
|
|
||||||
|
$db->beginTransaction();
|
||||||
{
|
{
|
||||||
if ($branch->HeadFromAPI === $branch->Head)
|
if ($branch->HeadFromAPI === $branch->Head)
|
||||||
{
|
{
|
||||||
$db->setUpdateDateOnBranch($branch);
|
$db->setUpdateDateOnBranch($branch);
|
||||||
$this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] is up to date");
|
$this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] is up to date");
|
||||||
|
$db->commitTransaction();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,19 +78,24 @@ abstract class StandardGitConnection implements IRemoteSource
|
|||||||
if ($updateCount === 0)
|
if ($updateCount === 0)
|
||||||
{
|
{
|
||||||
$this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] has no new commits");
|
$this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] has no new commits");
|
||||||
|
$db->commitTransaction();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->proclog("Found " . $updateCount . " new commits in Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "]");
|
$this->logger->proclog("Found " . $updateCount . " new commits in Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "]");
|
||||||
|
|
||||||
$repo_changed = true;
|
$anyChanged = true;
|
||||||
|
|
||||||
$db->setChangeDateOnBranch($branch);
|
$db->setChangeDateOnBranch($branch);
|
||||||
|
$db->setChangeDateOnRepository($repo);
|
||||||
|
$db->setUpdateDateOnRepository($repo);
|
||||||
|
}
|
||||||
|
$db->commitTransaction();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($repo_changed) $db->setChangeDateOnRepository($repo);
|
$db->beginTransaction();
|
||||||
if ($repo_changed) $anyChanged = true;
|
$db->setUpdateDateOnRepository($repo);
|
||||||
}
|
|
||||||
|
|
||||||
$db->commitTransaction();
|
$db->commitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user