diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-11-09 13:26:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 13:26:27 +0100 |
commit | dbe921452b47702f0066e8b6c88f2986950cdd0a (patch) | |
tree | efa33fe0ba9f4f036593ae3342a76ccd8bdb6d0f | |
parent | cc0f8c1b14faf9b37cd5198b475312d3d2fa119e (diff) | |
parent | 14718499567a1ba6b146b2eb62ea60414aa4907f (diff) | |
download | nextcloud-server-dbe921452b47702f0066e8b6c88f2986950cdd0a.tar.gz nextcloud-server-dbe921452b47702f0066e8b6c88f2986950cdd0a.zip |
Merge pull request #41295 from nextcloud/fix/has-reserved-job
fix(JobList#hasReservedJob): Break tie when multiple jobs are reserved
-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 2b42e2ff1ee..ab7392522b2 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -413,7 +413,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 eeca986423b..0b00326ca1a 100644 --- a/lib/public/BackgroundJob/IJobList.php +++ b/lib/public/BackgroundJob/IJobList.php @@ -160,7 +160,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 |