Closed smortexa closed 2 years ago
Octane's concurrent requests are separate processes. As such, there's no auth state or any "http" state at all. Please see the docs here: https://laravel.com/docs/8.x/octane#concurrent-tasks
@driesvints
What workerState->work
is when register request
callback , workerState->worker will not assigned in this closure . use ($server, $workerState, $serverState)
, $workerState is just inherit variables from the parent scope.
require_once __DIR__.'/WorkerState.php';
$workerState = new WorkerState;
$workerState->cacheTable = require DIR.'/createSwooleCacheTable.php'; $workerState->timerTable = $timerTable; $workerState->tables = require DIR.'/createSwooleTables.php';
2. $workerState is instance of WorkerState
$server->on('request', function ($request, $response) use ($server, $workerState, $serverState) { $workerState->lastRequestTime = microtime(true);
if ($workerState->timerTable) {
$workerState->timerTable->set($workerState->workerId, [
'worker_pid' => $workerState->workerPid,
'time' => time(),
]);
}
$workerState->worker->handle(...$workerState->client->marshalRequest(new RequestContext([
'swooleRequest' => $request,
'swooleResponse' => $response,
'publicPath' => $serverState['publicPath'],
'octaneConfig' => $serverState['octaneConfig'],
])));
if ($workerState->timerTable) {
$workerState->timerTable->del($workerState->workerId);
}
});
Description:
The Laravel authorization services do not work in
Octane::concurrently()
Steps To Reproduce:
Just try: