Skip to content

Commit

Permalink
Optimizaitons
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor committed Nov 7, 2024
1 parent 124305d commit c061242
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Events/Swoole.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@ public function run(): void
*/
public function stop(): void
{
// cancel all coroutines before Event::exit
// Cancel all coroutines before Event::exit
foreach (Coroutine::listCoroutines() as $coroutine) {
Coroutine::cancel($coroutine);
}
// Wait for coroutines to exit
usleep(20000);
Event::exit();
}

Expand Down
1 change: 0 additions & 1 deletion src/Protocols/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ protected static function sendStream(TcpConnection $connection, $handler, int $o
// Read file content from disk piece by piece and send to client.
$doWrite = function () use ($connection, $handler, $length, $offsetEnd) {
// Send buffer not full.
// @phpstan-ignore-next-line
while ($connection->context->bufferFull === false) {
// Read from disk.
$size = 1024 * 1024;
Expand Down

0 comments on commit c061242

Please sign in to comment.