Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(timeout): compare creation time to now - timeout #497

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

max-nextcloud
Copy link
Collaborator

Fixes #264.

@max-nextcloud max-nextcloud marked this pull request as draft January 20, 2025 15:46
@max-nextcloud
Copy link
Collaborator Author

Haven't been able to test this yet myself.

@juliusknorr
Copy link
Member

Please also check if we can cover this with tests, we have something around expiry in

public function testLockUserExpire() {
\OCP\Server::get(IConfig::class)->setAppValue(Application::APP_ID, ConfigService::LOCK_TIMEOUT, 30);
$file = $this->loginAndGetUserFolder(self::TEST_USER1)
->newFile('test-file-expire', 'AAA');
$this->shareFileWithUser($file, self::TEST_USER1, self::TEST_USER2);
$this->lockManager->lock(new LockContext($file, ILock::TYPE_USER, self::TEST_USER1));
$file->putContent('BBB');
/** @var File */
$file = $this->loginAndGetUserFolder(self::TEST_USER2)
->get('test-file-expire');
try {
$file->putContent('CCC');
$this->fail('Expected to throw a ManuallyLockedException');
} catch (ManuallyLockedException $e) {
self::assertInstanceOf(ManuallyLockedException::class, $e);
self::assertEquals('BBB', $file->getContent());
}
$this->toTheFuture(3600);
$file->putContent('CCC');
self::assertEquals('CCC', $file->getContent());
}
at least, but maybe that test does not cover it properly

@juliusknorr
Copy link
Member

Makes sense code wide 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential Logic Issue in GetLocksOlderThan Methods Data Retrieval.
2 participants