Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(caldav): Close DB cursor in reminder index background job
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst authored and backportbot-nextcloud[bot] committed Jun 6, 2023
commit 1196299b613cabb42a5f554dd515c8c41806d29d
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ private function buildIndex(int $offset, int $stopAt):int {
->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset)))
->orderBy('id', 'ASC');

$stmt = $query->execute();
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$result = $query->executeQuery();
while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
$offset = $row['id'];
if (is_resource($row['calendardata'])) {
$row['calendardata'] = stream_get_contents($row['calendardata']);
Expand All @@ -120,10 +120,12 @@ private function buildIndex(int $offset, int $stopAt):int {
}

if (($this->timeFactory->getTime() - $startTime) > 15) {
$result->closeCursor();
return $offset;
}
}

$result->closeCursor();
return $stopAt;
}
}