mirror of
https://github.com/friendica/friendica
synced 2025-04-23 08:30:10 +00:00
Fix Locks
- Wrong return of lock releasing with DBA provider - It's not possible to maintain Semaphore locks, since they aren't accessible by other processes Should solve https://github.com/friendica/friendica/issues/7298#issuecomment-521996540
This commit is contained in:
parent
e8561b480b
commit
c803dcb6c5
4 changed files with 74 additions and 48 deletions
|
@ -22,7 +22,7 @@ class SemaphoreLockTest extends LockTest
|
|||
$configMock
|
||||
->shouldReceive('get')
|
||||
->with('system', 'temppath', NULL, false)
|
||||
->andReturn('/tmp/');
|
||||
->andReturn('/tmp');
|
||||
$dice->shouldReceive('create')->with(Configuration::class)->andReturn($configMock);
|
||||
|
||||
// @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject
|
||||
|
@ -41,4 +41,32 @@ class SemaphoreLockTest extends LockTest
|
|||
// Semaphore doesn't work with TTL
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if semaphore locking works even for
|
||||
*/
|
||||
public function testMissingFileNotOverriding()
|
||||
{
|
||||
$file = get_temppath() . '/test.sem';
|
||||
|
||||
$this->assertTrue(file_exists($file));
|
||||
$this->assertFalse($this->instance->releaseLock('test', false));
|
||||
$this->assertTrue(file_exists($file));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test overriding semaphore release with already set semaphore
|
||||
* This test proves that semaphore locks cannot get released by other instances except themselves
|
||||
*
|
||||
* Check for Bug https://github.com/friendica/friendica/issues/7298#issuecomment-521996540
|
||||
* @see https://github.com/friendica/friendica/issues/7298#issuecomment-521996540
|
||||
*/
|
||||
public function testMissingFileOverriding()
|
||||
{
|
||||
$file = get_temppath() . '/test.sem';
|
||||
|
||||
$this->assertTrue(file_exists($file));
|
||||
$this->assertFalse($this->instance->releaseLock('test', true));
|
||||
$this->assertTrue(file_exists($file));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue