Skip to content

Commit f2e9044

Browse files
committed
fix(dav): close cursor when fetching max id
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
1 parent 011c19c commit f2e9044

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

apps/dav/lib/CalDAV/CalDavBackend.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3139,7 +3139,9 @@ public function pruneOutdatedSyncTokens(int $keep = 10_000): int {
31393139
$query->select($query->func()->max('id'))
31403140
->from('calendarchanges');
31413141

3142-
$maxId = $query->executeQuery()->fetchOne();
3142+
$result = $query->executeQuery();
3143+
$maxId = (int) $result->fetchOne();
3144+
$result->closeCursor();
31433145
if (!$maxId || $maxId < $keep) {
31443146
return 0;
31453147
}

apps/dav/lib/CardDAV/CardDavBackend.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,9 @@ public function pruneOutdatedSyncTokens(int $keep = 10_000): int {
14041404
$query->select($query->func()->max('id'))
14051405
->from('addressbookchanges');
14061406

1407-
$maxId = $query->executeQuery()->fetchOne();
1407+
$result = $query->executeQuery();
1408+
$maxId = (int) $result->fetchOne();
1409+
$result->closeCursor();
14081410
if (!$maxId || $maxId < $keep) {
14091411
return 0;
14101412
}

0 commit comments

Comments
 (0)