diff options
author | Marcel Klehr <mklehr@gmx.net> | 2023-11-10 14:33:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 14:33:49 +0100 |
commit | 8e29b026aaa5ae9ca9a3ab85743097a37f9a3573 (patch) | |
tree | f4569ad2cec2447fbda60a88dbf1c1ffc67e7925 /lib | |
parent | 4ffee4f92b957d81e96261d9a4707bdba0c905fd (diff) | |
parent | 708c0a824938efe784652cce598efda1caf1f11c (diff) | |
download | nextcloud-server-8e29b026aaa5ae9ca9a3ab85743097a37f9a3573.tar.gz nextcloud-server-8e29b026aaa5ae9ca9a3ab85743097a37f9a3573.zip |
Merge pull request #41359 from nextcloud/backport/41295/stable27
[stable27] fix(JobList#hasReservedJob): Break tie when multiple jobs are reserved
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/BackgroundJob/JobList.php | 2 | ||||
-rw-r--r-- | lib/public/BackgroundJob/IJobList.php | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index 36cccbd4eab..ae214f69509 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -406,7 +406,7 @@ class JobList implements IJobList { $query = $this->connection->getQueryBuilder(); $query->select('*') ->from('jobs') - ->where($query->expr()->neq('reserved_at', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))) + ->where($query->expr()->gt('reserved_at', $query->createNamedParameter($this->timeFactory->getTime() - 6 * 3600, IQueryBuilder::PARAM_INT))) ->setMaxResults(1); if ($className !== null) { diff --git a/lib/public/BackgroundJob/IJobList.php b/lib/public/BackgroundJob/IJobList.php index 65e2f5b6250..a0f32cb0359 100644 --- a/lib/public/BackgroundJob/IJobList.php +++ b/lib/public/BackgroundJob/IJobList.php @@ -147,7 +147,8 @@ interface IJobList { public function resetBackgroundJob(IJob $job): void; /** - * Checks whether a job of the passed class is reserved to run + * Checks whether a job of the passed class was reserved to run + * in the last 6h * * @param string|null $className * @return bool |