Skip to content

Commit

Permalink
Ontology::import(): prolong repository transaction when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Feb 17, 2025
1 parent ec73c10 commit 9e9cf46
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/acdhOeaw/arche/schemaImport/Ontology.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
*/
class Ontology {

const PROLONG_TIMEOUT = 10;

/**
* restrictions go first as checkRestriction() can affect the whole graph
* @var array<string>
Expand Down Expand Up @@ -137,6 +139,7 @@ public function import(Repo $repo, bool $verbose = false,
$annotationTmpls = array_map(fn($x) => new PT($x), iterator_to_array($annotationProps));
$deleteProp = $repo->getSchema()->delete;

$t = time();
$ids = [];
$toImport = new MC($repo, null);
echo $verbose ? "### Preparing ontology for ingestion\n" : '';
Expand Down Expand Up @@ -176,6 +179,10 @@ public function import(Repo $repo, bool $verbose = false,
} else {
echo $verbose ? "Skipping " . $i->getNode() . " because of failed checks\n" : '';
}
if (time() - $t > self::PROLONG_TIMEOUT) {
$repo->prolong();
$t = time();
}
}
}

Expand Down

0 comments on commit 9e9cf46

Please sign in to comment.