]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(caldav): Close DB cursor in reminder index background job 38660/head
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Mon, 5 Jun 2023 16:47:24 +0000 (18:47 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Tue, 6 Jun 2023 07:41:35 +0000 (07:41 +0000)
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
apps/dav/lib/BackgroundJob/BuildReminderIndexBackgroundJob.php

index 2ae47ee89ea319cb2a537745e7d3129a4d411e42..a38524da9e2b822e9bab9f179bc14c7272259a8f 100644 (file)
@@ -105,8 +105,8 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
                        ->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 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
                        }
 
                        if (($this->timeFactory->getTime() - $startTime) > 15) {
+                               $result->closeCursor();
                                return $offset;
                        }
                }
 
+               $result->closeCursor();
                return $stopAt;
        }
 }