【发布时间】:2019-09-26 05:12:32
【问题描述】:
Laravel 按顺序处理用户的并发请求。如何同时处理请求?似乎会话(保存在 Redis 存储中)阻止了并发请求,但也许这不是原因。问题出在哪里?
Vue 发送请求...
async manageData() {
// array of chart's properties
const charts = await axios.post('/report/chart_data', {id: this.id);
// concurrent requests with variable 'charts'
const result = await Promise.all(
charts.map((chart, key) => axios.post('/report/data_range', {id: key}))
);
}
.env 设置
SESSION_DRIVER=redis
SESSION_LIFETIME=120
web.php
Route::post('report/data_range','AnalyticsApp\ReportController@ChartDataGet');
ReportController.php
public function ChartDataGet(Request $request)
{
return Chart::find($request->id)
}
请求的时间
【问题讨论】: