Skip to content

Commit fec2cc6

Browse files
authored
Merge pull request #38649 from nextcloud/fix/caldav/close-reminder-index-job-cursor
fix(caldav): Close DB cursor in reminder index background job
2 parents 3846ec2 + 6f3f84e commit fec2cc6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ private function buildIndex(int $offset, int $stopAt):int {
105105
->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset)))
106106
->orderBy('id', 'ASC');
107107

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

122122
if (($this->timeFactory->getTime() - $startTime) > 15) {
123+
$result->closeCursor();
123124
return $offset;
124125
}
125126
}
126127

128+
$result->closeCursor();
127129
return $stopAt;
128130
}
129131
}

0 commit comments

Comments
 (0)