I am not able to access other laravel routes when I am accessing the route through which I am reading about 100 files line by line and then comparing the lines one by one with a standard data set file to save the data in db. Once I run this route, which takes almost 30 minutes to complete, I am unable to access any other route. Once that is finished or I turn off the wamp server(MySQL service) then I can access all routes.
This is the function which reads the data from around 100 files and send to another function for comparison
public function readData(){
$filename = public_path() . '/online/daraz/smartphones.txt';
$onlineData = file_get_contents($filename);
$di = new \RecursiveDirectoryIterator(public_path().'/scrap/');
foreach (new \RecursiveIteratorIterator($di) as $filename => $file) {
if($file->getExtension() == 'txt' && $file->isFile()){
/*if(strtolower(explode(".", $file->getFileName())[0]) == $brandName){*/
try
{
$onlyFileName = strtolower(explode(".", $file->getFilename())[0]);
$gsmData = file_get_contents($filename);
//$this->saveData($gsmData, $onlyFileName);
$this->compareData($gsmData, $onlineData, $onlyFileName);
}
catch (FileNotFoundException $exception)
{
die("The file doesn't exist");
}
//}
}
/*if(@is_array(getimagesize($file))){
echo 'true';
} else {
echo 'false';
}*/
}
}
via Adam nick