-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work in progress #131
Work in progress #131
Conversation
src/Http/Adapter/Swoole/Server.php
Outdated
$this->server = new SwooleServer($host, $port); | ||
$this->server->set(\array_merge($settings, [ | ||
'enable_coroutine' => true | ||
'open_http2_protocol' => true, | ||
// 'http_compression' => true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enable back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, left few comments
.vscode/launch.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be we should remove this file
src/Http/Adapter/Swoole/Server.php
Outdated
'open_http2_protocol' => true, | ||
// 'http_compression' => true, | ||
// 'http_compression_level' => 6, | ||
|
||
// Server | ||
// 'log_level' => 2, | ||
'dispatch_mode' => 3, | ||
'worker_num' => $workerNumber, | ||
'reactor_num' => swoole_cpu_num() * 2, | ||
'task_worker_num' => $workerNumber, | ||
'open_cpu_affinity' => true, | ||
|
||
// Coroutine | ||
'enable_coroutine' => true, | ||
'max_coroutine' => 300000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't we want to allow user to override these values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do allow.
src/Http/Router.php
Outdated
* | ||
* @return array | ||
*/ | ||
public static function getRoutes(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used anywhere.
src/Http/Http.php
Outdated
unset(self::$resourcesCallbacks[$context]); | ||
} | ||
$this->server->onRequest(function ($request, $response) { | ||
$context = clone $this->container; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cloning twice
src/Http/Http.php
Outdated
}, [], $context); | ||
\call_user_func_array($error->getAction(), $this->getArguments($error, $context, [], $request->getParams())); | ||
$dependency = new Dependency(); | ||
$this->container->set( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this error be set on context
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow, which error?
@@ -135,18 +116,25 @@ class Http | |||
* @param Adapter $server | |||
* @param string $timezone | |||
*/ | |||
public function __construct(Adapter $server, string $timezone) | |||
public function __construct(Adapter $server, Container $container, string $timezone) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not make container optional and auto initialize if not provided?
*/ | ||
public static function setResource(string $name, callable $callback, array $injections = [], string $context = 'utopia'): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not also provide the setResource so that people can still set dependency using this method, but internally use the container to set these dependencies? I still like having this way to set resource here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can now do getContainer->set();
Feat base servers
Feat: Rules for Multiple validator
# Conflicts: # composer.lock
No description provided.