mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 04:23:49 +00:00
Fix error when cleaning non-existent stored object versions
Prevent the `RemoveOldVersionMessageHandler` from throwing errors when the stored object version is missing on disk. Introduced a check to log a notice instead of attempting deletion in such cases and added corresponding test coverage.
This commit is contained in:
@@ -62,7 +62,15 @@ final readonly class RemoveOldVersionMessageHandler implements MessageHandlerInt
|
||||
|
||||
$storedObject = $storedObjectVersion->getStoredObject();
|
||||
|
||||
$this->storedObjectManager->delete($storedObjectVersion);
|
||||
if ($this->storedObjectManager->exists($storedObjectVersion)) {
|
||||
$this->storedObjectManager->delete($storedObjectVersion);
|
||||
} else {
|
||||
$this->logger->notice(
|
||||
self::LOG_PREFIX.'Stored object version does not exists any more.',
|
||||
['storedObjectVersionName' => $storedObjectVersion->getFilename()],
|
||||
);
|
||||
}
|
||||
|
||||
// to ensure an immediate deletion
|
||||
$this->entityManager->remove($storedObjectVersion);
|
||||
|
||||
|
Reference in New Issue
Block a user