diff --git a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php index 2ae47ee89ea31..a38524da9e2b8 100644 --- a/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php +++ b/apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php @@ -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']); @@ -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; } }