Cannot realtime read from redis Cannot realtime read from redis laravel laravel

Cannot realtime read from redis


Try to run this code in a background process like async queues or crons

while($s = fgets($pipes[2])){if(strpos($s, "Progress:") !== FALSE){    Log::info(100 * substr($s, -10, 4) . '%');    $this->redis->SET('sliceProgress' . $uid, 100 * substr($s, -10, 4) . '%');}}


I believe the problem could be Session Lock. Consider you fired POST request following the Multiple GET calls. Now if session lock is there, none of the get request will be handled by PHP until the first one is done.

How Session Lock works?
Well php simply lock the session file to read, so all other apache processes have to wait. Laravel also use file based session management, so.

Now removing session lock is not a good idea, though you can do that. Try exposing this Get Service from different host or port.

I am not 100% sure how laravel handles session lock, so just cross check if this is the issue.

Removing Session Lock:
First Way: Use method once you done with session handling session_write_close.
Second : Pass read_and_close to be true while starting session with session_start

Not sure whether laravel allows to do that. There are other ways of doing realtime progress sync.