-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Open
Description
Symfony version(s) affected
7.3.4
Description
When using InMemoryStore during tests, it doen't simulate ttl expiration and fails some functional tests
How to reproduce
Use this snippet to reproduce:
public function testLockServiceWithTtl(): void
{
$lockService = new LockFactory(new InMemoryStore());
$key = 'test_lock_service_ttl:'.time();
$lock1 = $lockService->createLock($key, ttl: 1);
self::assertTrue($lock1->acquire());
sleep(2);
self::assertFalse($lock1->isExpired());
$lock2 = $lockService->createLock($key, ttl: 1);
$lock2->acquire();
self::assertTrue($lock2->isAcquired()); // fails here
$lock2->release();
}
Possible Solution
No response
Additional Context
No response