Skip to content

Commit

Permalink
Remove WorkerModule abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
luzrain committed Sep 30, 2024
1 parent 14bb52f commit 5824f0b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 29 deletions.
6 changes: 4 additions & 2 deletions src/Plugin/HttpServer/HttpServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private function onWorkerStart(WorkerProcess $worker): void
);
}

$worker->startWorkerModule(new HttpServerModule(
$module = new HttpServerModule(
listen: self::createListenList($this->listen),
requestHandler: $requestHandler,
middleware: $this->middleware,
Expand All @@ -70,7 +70,9 @@ private function onWorkerStart(WorkerProcess $worker): void
connectionTimeout: $this->connectionTimeout,
headerSizeLimit: $this->headerSizeLimit,
bodySizeLimit: $this->bodySizeLimit,
));
);

$module->start($worker);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Plugin/HttpServer/HttpServerModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
use Luzrain\PHPStreamServer\Plugin\HttpServer\Internal\TrafficCountingClientFactory;
use Luzrain\PHPStreamServer\Plugin\HttpServer\Internal\TrafficCountingSocketFactory;
use Luzrain\PHPStreamServer\Plugin\HttpServer\Middleware\StaticMiddleware;
use Luzrain\PHPStreamServer\Plugin\WorkerModule;
use Luzrain\PHPStreamServer\WorkerProcessInterface;

final readonly class HttpServerModule implements WorkerModule
final readonly class HttpServerModule
{
private const DEFAULT_TCP_BACKLOG = 65536;

Expand Down
12 changes: 0 additions & 12 deletions src/Plugin/WorkerModule.php

This file was deleted.

6 changes: 0 additions & 6 deletions src/WorkerProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Luzrain\PHPStreamServer\Message\ProcessDetachedEvent;
use Luzrain\PHPStreamServer\Message\ProcessHeartbeatEvent;
use Luzrain\PHPStreamServer\Message\ProcessSpawnedEvent;
use Luzrain\PHPStreamServer\Plugin\WorkerModule;
use Luzrain\PHPStreamServer\ReloadStrategy\ReloadStrategyInterface;
use Revolt\EventLoop;
use Revolt\EventLoop\DriverFactory;
Expand Down Expand Up @@ -159,11 +158,6 @@ public function detach(): void
\gc_mem_caches();
}

public function startWorkerModule(WorkerModule $module): void
{
$module->start($this);
}

public function addReloadStrategy(ReloadStrategyInterface ...$reloadStrategies): void
{
$this->reloadStrategyTrigger->addReloadStrategy(...$reloadStrategies);
Expand Down
7 changes: 0 additions & 7 deletions src/WorkerProcessInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Luzrain\PHPStreamServer;

use Luzrain\PHPStreamServer\Plugin\WorkerModule;

interface WorkerProcessInterface extends ProcessInterface
{
final public const RELOAD_EXIT_CODE = 100;
Expand All @@ -21,11 +19,6 @@ public function stop(int $code = 0): void;
*/
public function reload(): void;

/**
* Start worker module in this worker
*/
public function startWorkerModule(WorkerModule $module): void;

/**
* Count of processes
*/
Expand Down

0 comments on commit 5824f0b

Please sign in to comment.