mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 10:06:37 -04:00
fix: chunk storage ids when preload storage info
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
829236fc32
commit
6a316b23b5
1 changed files with 14 additions and 12 deletions
|
|
@ -42,21 +42,23 @@ class StorageGlobal {
|
|||
$builder = $this->connection->getQueryBuilder();
|
||||
$query = $builder->select(['id', 'numeric_id', 'available', 'last_checked'])
|
||||
->from('storages')
|
||||
->where($builder->expr()->in('id', $builder->createNamedParameter(array_values($storageIds), IQueryBuilder::PARAM_STR_ARRAY)));
|
||||
->where($builder->expr()->in('id', $builder->createParameter('ids'), IQueryBuilder::PARAM_STR_ARRAY));
|
||||
|
||||
$result = $query->executeQuery();
|
||||
while (($row = $result->fetch()) !== false) {
|
||||
$normalizedRow = [
|
||||
'id' => (string)$row['id'],
|
||||
'numeric_id' => (int)$row['numeric_id'],
|
||||
'available' => (bool)$row['available'],
|
||||
'last_checked' => (int)$row['last_checked'],
|
||||
];
|
||||
foreach (array_chunk($storageIds, 1000) as $chunk) {
|
||||
$query->setParameter('ids', $chunk, IQueryBuilder::PARAM_STR_ARRAY);
|
||||
|
||||
$this->cache[$normalizedRow['id']] = $normalizedRow;
|
||||
$result = $query->executeQuery();
|
||||
while (($row = $result->fetch()) !== false) {
|
||||
$normalizedRow = [
|
||||
'id' => (string)$row['id'],
|
||||
'numeric_id' => (int)$row['numeric_id'],
|
||||
'available' => (bool)$row['available'],
|
||||
'last_checked' => (int)$row['last_checked'],
|
||||
];
|
||||
|
||||
$this->cache[$normalizedRow['id']] = $normalizedRow;
|
||||
}
|
||||
}
|
||||
|
||||
$result->closeCursor();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue