Skip to content

Commit 83c2afb

Browse files
authored
Fix Swoole in-memory table size (#818)
* Add can use all available rows test * Use conflict proportion 1 on TableFactory --------- Co-authored-by: miguilim <[email protected]>
1 parent 5a0c867 commit 83c2afb

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/Tables/TableFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public static function make($size)
1414
static::ensureDependenciesAreLoaded();
1515

1616
return extension_loaded('openswoole')
17-
? new OpenSwooleTable($size)
18-
: new SwooleTable($size);
17+
? new OpenSwooleTable($size, 1)
18+
: new SwooleTable($size, 1);
1919
}
2020

2121
/**

tests/TableTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ public function test_it_gets_used_while_creating_an_timer_table()
6363
return $this->assertInstanceOf(SwooleTable::class, $table);
6464
}
6565

66+
public function test_can_use_all_available_rows()
67+
{
68+
$table = $this->createSwooleTable();
69+
70+
for ($i = 0; $i < 1000; $i++) {
71+
$table->set($i, ['string' => 'foo']);
72+
}
73+
74+
$this->assertSame(1000, $table->count());
75+
}
76+
6677
/**
6778
* @dataProvider validStringValues
6879
*/

0 commit comments

Comments
 (0)