Skip to content

Commit

Permalink
fixup! fix(timeout): compare creation time to now - timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr committed Feb 5, 2025
1 parent a547070 commit db98b9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Db/LocksRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Exception;
use OCA\FilesLock\Exceptions\LockNotFoundException;
use OCA\FilesLock\Model\FileLock;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\DB\QueryBuilder\IQueryBuilder;

/**
Expand Down
5 changes: 5 additions & 0 deletions lib/Service/LockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use OCP\IRequest;
use OCP\IUserManager;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;

class LockService {
public const PREFIX = 'files_lock';
Expand All @@ -45,6 +46,7 @@ class LockService {
private IEventDispatcher $eventDispatcher;
private IUserSession $userSession;
private IRequest $request;
private LoggerInterface $logger;


private array $locks = [];
Expand All @@ -64,6 +66,7 @@ public function __construct(
IEventDispatcher $eventDispatcher,
IUserSession $userSession,
IRequest $request,
LoggerInterface $logger,
) {
$this->l10n = $l10n;
$this->userManager = $userManager;
Expand All @@ -74,6 +77,7 @@ public function __construct(
$this->eventDispatcher = $eventDispatcher;
$this->userSession = $userSession;
$this->request = $request;
$this->logger = $logger;

$this->setup('app', 'files_lock');
}
Expand Down Expand Up @@ -289,6 +293,7 @@ public function getDeprecatedLocks(): array {
try {
$locks = $this->locksRequest->getLocksOlderThan($timeout);
} catch (Exception $e) {
$this->logger->warning('Failed to get locks older then timeout', ['exception' => $e]);
return [];
}

Expand Down

0 comments on commit db98b9d

Please sign in to comment.