Added more fine-granular transactions to EGG2
This commit is contained in:
parent
8186165019
commit
81bbdd1aef
4
www/extern/egg/ExtendedGitGraph2.php
vendored
4
www/extern/egg/ExtendedGitGraph2.php
vendored
@ -62,7 +62,6 @@ class ExtendedGitGraph2 implements ILogger
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->db->open();
|
$this->db->open();
|
||||||
$this->db->beginTransaction();
|
|
||||||
|
|
||||||
$this->proclog("Start incremental data update");
|
$this->proclog("Start incremental data update");
|
||||||
$this->proclog();
|
$this->proclog();
|
||||||
@ -76,11 +75,12 @@ class ExtendedGitGraph2 implements ILogger
|
|||||||
$this->proclog();
|
$this->proclog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->db->beginTransaction();
|
||||||
$this->db->deleteOldSources(array_map(function (IRemoteSource $v){ return $v->getName(); }, $this->sources));
|
$this->db->deleteOldSources(array_map(function (IRemoteSource $v){ return $v->getName(); }, $this->sources));
|
||||||
|
$this->db->commitTransaction();
|
||||||
|
|
||||||
$this->proclog("Update finished.");
|
$this->proclog("Update finished.");
|
||||||
|
|
||||||
$this->db->commitTransaction();
|
|
||||||
$this->proclog("Data written.");
|
$this->proclog("Data written.");
|
||||||
|
|
||||||
$this->db->close();
|
$this->db->close();
|
||||||
|
56
www/extern/egg/RemoteSource.php
vendored
56
www/extern/egg/RemoteSource.php
vendored
@ -51,49 +51,59 @@ abstract class StandardGitConnection implements IRemoteSource
|
|||||||
{
|
{
|
||||||
$this->preUpdate();
|
$this->preUpdate();
|
||||||
|
|
||||||
|
$db->beginTransaction();
|
||||||
$repos = $this->listAndUpdateRepositories($db);
|
$repos = $this->listAndUpdateRepositories($db);
|
||||||
|
$db->commitTransaction();
|
||||||
|
|
||||||
$anyChanged = false;
|
$anyChanged = false;
|
||||||
|
|
||||||
foreach ($repos as $repo)
|
foreach ($repos as $repo)
|
||||||
{
|
{
|
||||||
$branches = $this->listAndUpdateBranches($db, $repo);
|
$db->beginTransaction();
|
||||||
$db->setUpdateDateOnRepository($repo);
|
|
||||||
|
|
||||||
$repo_changed = false;
|
|
||||||
foreach ($branches as $branch)
|
|
||||||
{
|
{
|
||||||
if ($branch->HeadFromAPI === $branch->Head)
|
$branches = $this->listAndUpdateBranches($db, $repo);
|
||||||
|
$db->setUpdateDateOnRepository($repo);
|
||||||
|
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
$commits = $this->listAndUpdateCommits($db, $repo, $branch);
|
||||||
$db->setUpdateDateOnBranch($branch);
|
$db->setUpdateDateOnBranch($branch);
|
||||||
$this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] is up to date");
|
if (count($commits) === 0)
|
||||||
continue;
|
{
|
||||||
|
$this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] has no new commits");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->logger->proclog("Found " . count($commits) . " new commits in Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "]");
|
||||||
|
|
||||||
|
$repo_changed = true;
|
||||||
|
$db->setChangeDateOnBranch($branch);
|
||||||
}
|
}
|
||||||
|
|
||||||
$commits = $this->listAndUpdateCommits($db, $repo, $branch);
|
if ($repo_changed) $db->setChangeDateOnRepository($repo);
|
||||||
$db->setUpdateDateOnBranch($branch);
|
if ($repo_changed) $anyChanged = true;
|
||||||
if (count($commits) === 0)
|
|
||||||
{
|
|
||||||
$this->logger->proclog("Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "] has no new commits");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logger->proclog("Found " . count($commits) . " new commits in Branch: [" . $this->name . "|" . $repo->Name . "|" . $branch->Name . "]");
|
|
||||||
|
|
||||||
$repo_changed = true;
|
|
||||||
$db->setChangeDateOnBranch($branch);
|
|
||||||
}
|
}
|
||||||
|
$db->commitTransaction();
|
||||||
if ($repo_changed) $db->setChangeDateOnRepository($repo);
|
|
||||||
if ($repo_changed) $anyChanged = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($anyChanged)
|
if ($anyChanged)
|
||||||
{
|
{
|
||||||
|
$db->beginTransaction();
|
||||||
$db->deleteDanglingCommitdata($this->name);
|
$db->deleteDanglingCommitdata($this->name);
|
||||||
|
$db->commitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db->beginTransaction();
|
||||||
$this->postUpdate();
|
$this->postUpdate();
|
||||||
|
$db->commitTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user