Uh oh!
There was an error while loading. Please reload this page.
Truncate tables and rename documents folder on reset - #5918
Conversation
juliusknorr
left a comment
There was a problem hiding this comment.
👍 For the truncate part, would appreciate a review for my first commit then
| $fileIds = array_map(static function (Document $document) { | ||
| return $document->getId(); | ||
| }, $this->documentService->getAll()); | ||
| $fileIds = $this->documentService->getAll(); |
There was a problem hiding this comment.
@juliushaertl I don't understand this change. DocumentService->getAll() returns an array of Document objects, not the file IDs. How is this supposed to work?
There was a problem hiding this comment.
Tested and indeed it broke with your current approach. The old approach didn't work either as array_map() cannot be run against a Generator. I pushed a fix:
$fileIds = [];
$documents = $this->documentService->getAll();
foreach ($documentsas$document) {
$fileIds[] = $document->getId();
}29cd087 to
fe9a94fCompareSigned-off-by: Julius Härtl <jus@bitgrid.net>
mejo-
commented
Jun 17, 2024
Apart from the commented part, your changes look good to me @juliushaertl Could you review my changes another time, given that I implemented the logic to rename the directory and clean up old directories after your last review? |
This is way more performant than iterating over all existing sessions. Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
| public function clearAll(): void { | ||
| $qb = $this->db->getQueryBuilder(); | ||
| $qb->delete($this->getTableName()) |
There was a problem hiding this comment.
truncate and delete are different things. Truncate might be faster than delete, but not all DB engines support it afaik. Not sure what is the current state in doctrine. OK for now.
There was a problem hiding this comment.
I tested with 120.000 entries and it was super fast. So I guess it's ok for now 😬
| public function clearAll(): void { | ||
| $qb = $this->db->getQueryBuilder(); | ||
| $qb->delete($this->getTableName()) |
| public function clearAll(): void { | ||
| $qb = $this->db->getQueryBuilder(); | ||
| $qb->delete($this->getTableName()) |
blizzz
commented
Jun 17, 2024
/backport to stable29 |
blizzz
commented
Jun 17, 2024
/backport to stable28 |
blizzz
commented
Jun 17, 2024
/backport to stable27 |
blizzz
commented
Jun 17, 2024
Runner 9 was green before, Runner 1 is a known Flaky test → Merging. |
📝 Summary
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)