Skip to content

Commit 43b7e2f

Browse files
committed
fix(timeout): compare creation time to now - timeout
Fixes #264. Signed-off-by: Max <[email protected]>
1 parent 6e5a76c commit 43b7e2f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Db/LocksRequest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ public function getAll(): array {
124124
* @throws Exception
125125
*/
126126
public function getLocksOlderThan(int $timeout): array {
127+
$now = \OC::$server->get(ITimeFactory::class)->getTime();
128+
$oldCreationTime = $now - $timeout * 60;
127129
$qb = $this->getLocksSelectSql();
128-
$qb->andWhere($qb->expr()->lt('l.creation', $qb->createNamedParameter($timeout * 60, IQueryBuilder::PARAM_INT)));
130+
$qb->andWhere($qb->expr()->lt('l.creation', $qb->createNamedParameter($oldCreationTime, IQueryBuilder::PARAM_INT)));
129131

130132
return $this->getLocksFromRequest($qb);
131133
}

0 commit comments

Comments
 (0)