Skip to content

Commit

Permalink
fix harvest
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisLambrechts committed Jan 9, 2025
1 parent abb10de commit 241fc37
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions modules/OaiPmhHarvester/src/Job/Harvest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,7 @@ public function perform()
gc_collect_cycles();
$this->logger->info("mem: ".memory_get_usage());

$identityMap = $entityManager->getUnitOfWork()->getIdentityMap();
foreach ($identityMap as $entityClass => $entities) {
foreach ($entities as $idHash => $entity) {
if (!isset($originalIdentityMap[$entityClass][$idHash])) {
$entityManager->detach($entity);
}
}
}


$resumptionToken = isset($response->ListRecords->resumptionToken) && $response->ListRecords->resumptionToken <> ''
? $response->ListRecords->resumptionToken
: false;
Expand All @@ -306,6 +298,15 @@ public function perform()
'o-module-oai-pmh-harvester:stats' => $stats,
];
$this->api->update('oaipmhharvester_harvests', $harvestId, $harvestData);
$identityMap = $entityManager->getUnitOfWork()->getIdentityMap();
foreach ($identityMap as $entityClass => $entities) {
foreach ($entities as $idHash => $entity) {
if (!isset($originalIdentityMap[$entityClass][$idHash])) {
$entityManager->detach($entity);
}
}
}

} while ($resumptionToken);

// Update job.
Expand Down Expand Up @@ -659,7 +660,7 @@ private function _alamireToJson(SimpleXMLElement $record,$itemSetId,$args)
if($result){
$this->logger->info("result");
$elementTexts['alamire:relatedProductionUnit'][$i] = [
'property_id' => 394,
'property_id' => 438,
'type' => 'resource',
'is_public' => true,
'value_resource_id' => $result[0]->id(),
Expand Down

0 comments on commit 241fc37

Please sign in to comment.