why laravel update database asynchronously

my laravel source code and mysql database are on separate server.

there is wired problem and that is database get updated asynchronously.

it does not wait for database got updated and execute the next line.

the job queue is disable and I do not know why this problem happens.

when I add sleep(3) between database update and next line .

it works. it wait 3 seconds and database updates and then next line execute.

please help me??

what does cause it? web server ? database config??

$this->current_row()->update(['status'=>'accepted' ]);
sleep(3) ;
$current= $this->current_row() ;

it works on my local and shared host but it not work on server which database is separate.

at final the row updates but at next line of database update

I need updated row and it does not updated yet

help


Solution 1:

I found the issue. the problem was about database . there are two databases , master and slave .

the read operation is done from slave database and the write operation in master database.

the synchronize between master and slave take a time so that is the problem