Skip to content

Commit

Permalink
feat: add support for Swoole task_object option
Browse files Browse the repository at this point in the history
  • Loading branch information
tam.nguyen committed Jan 6, 2025
1 parent c4484bf commit 2adadee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/swoole-server
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ $server->on('request', function ($request, $response) use ($server, $workerState
* `$server->setting` of workers and task workers being *NULL*.
* This bug is already fixed, see this [issue](https://github.com/swoole/swoole-src/issues/5651).
*/
if ($server->setting['task_enable_coroutine'] || $server->setting['task_use_object']) {
$use_task_object = false;
foreach (['task_enable_coroutine', 'task_use_object', 'task_object'] as $key) {
$use_task_object = $use_task_object || (array_key_exists($key, $server->setting) && $server->setting[$key]);
}
if ($use_task_object) {
$server->on(
'task',
function (Server $server, Task $task) use ($workerState) {
Expand Down

0 comments on commit 2adadee

Please sign in to comment.