With the new preview backend, we are deleting preview individually, this is probably expensive and slow.
|
public function deleteAll(): void { |
|
$lastId = 0; |
|
while (true) { |
|
$previews = $this->previewMapper->getPreviews($lastId, 1000); |
|
$i = 0; |
|
|
|
// FIXME: Should we use transaction here? Du to the I/O created when |
|
// deleting the previews from the storage, which might be on a network |
|
// This might take a non trivial amount of time where the DB is locked. |
|
foreach ($previews as $preview) { |
|
$this->deletePreview($preview); |
|
$i++; |
|
$lastId = $preview->getId(); |
|
} |
|
|
|
if ($i !== 1000) { |
|
break; |
|
} |
|
} |
|
} |
|
|
Shouldn't we do it in one go?
- Flush the preview table
- Delete the preview directory
Previously it was done individually too.
With the new preview backend, we are deleting preview individually, this is probably expensive and slow.
server/lib/private/Preview/PreviewService.php
Lines 112 to 132 in b6e90ac
Shouldn't we do it in one go?
Previously it was done individually too.