Skip to content

Commit

Permalink
fix(timeout): compare creation time to now - timeout
Browse files Browse the repository at this point in the history
Fixes #264.

Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Jan 20, 2025
1 parent 6e5a76c commit 43b7e2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Db/LocksRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 43b7e2f

Please sign in to comment.