我有一个脚本,其中包含5到10个作业,使用Laravel 5.7 + Angular7总共需要5-10分钟。
仅运行作业(大约需要1-2分钟),Angular和Laravel可以正常工作。
同时运行所有作业,Angular将获得500个错误响应。
我试图在Laravel中添加此命令,但Laravel偶尔可以工作
set_time_limit(20000);
如何解决该问题?
角度:
this.UploadstatusInboundataExcel = {status: '', message: ''};
const InboundData = new FormData();
InboundData.append('InboundData', this.selectedInboundDataFile, this.selectedInboundDataFile.name);
this.inbounddataservice.importInboundData(InboundData)
.subscribe(
events => {
this.UploadstatusInboundataExcel = events;
if (this.UploadstatusInboundataExcel) {
if (this.UploadstatusInboundataExcel.status='Success') {
this.resultForDsec = 'DSEC Excel Upload completed.'
}
}
},
err => {
{
this.UploadstatusInboundataExcel = {status: 'Error', message: 'Error: ' + err.name};
console.log(this.UploadstatusInboundataExcel);
}
}
);
importInboundData(formData) {
return this.http.post( this.createmultidataUrl , formData, {
reportProgress: true,
observe: 'events'
}).pipe(
map(event =>
this.getEventMessage(event, formData),
)
);
}
Laravel:
public function uploadDatabyExcel(Request $request) {
set_time_limit(20000);
$result = array(
'result'=> array(
'InboundNationality' => '',
'InboundAir' => '',
'InboundSea' => '',
'InboundLand' => '',
'InboundProvince' => ''
)
);
$result['result']['InboundNationality'] = $this->importInboundNationality($request);
$result['result']['InboundSea'] = $this->importInboundSea($request);
$result['result']['InboundLand'] = $this->importInboundLand($request);
$result['result']['InboundAir'] = $this->importInboundAir($request);
$result['result']['InboundProvince'] = $this->importInboundProvince($request);
return response()->json($result, 200);
}