From 43b7e2f65aeff1a21fe0d3a579459bde05a9a146 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 20 Jan 2025 16:20:23 +0100 Subject: [PATCH] fix(timeout): compare creation time to now - timeout Fixes #264. Signed-off-by: Max --- lib/Db/LocksRequest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Db/LocksRequest.php b/lib/Db/LocksRequest.php index 3948f0fc..bddcc0f0 100644 --- a/lib/Db/LocksRequest.php +++ b/lib/Db/LocksRequest.php @@ -124,8 +124,10 @@ public function getAll(): array { * @throws Exception */ public function getLocksOlderThan(int $timeout): array { + $now = \OC::$server->get(ITimeFactory::class)->getTime(); + $oldCreationTime = $now - $timeout * 60; $qb = $this->getLocksSelectSql(); - $qb->andWhere($qb->expr()->lt('l.creation', $qb->createNamedParameter($timeout * 60, IQueryBuilder::PARAM_INT))); + $qb->andWhere($qb->expr()->lt('l.creation', $qb->createNamedParameter($oldCreationTime, IQueryBuilder::PARAM_INT))); return $this->getLocksFromRequest($qb); }