diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index 638919d4c3927..3846aed3d61ba 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -397,7 +397,9 @@ public function hasReservedJob(?string $className = null): bool { try { $result = $query->executeQuery(); - return count($result->fetchAll()) > 0; + $hasReservedJobs = $result->fetch() !== false; + $result->closeCursor(); + return $hasReservedJobs; } catch (Exception $e) { return false; }