Closed wapmorgan closed 2 months ago
Also another option is to remove LOCK_NB
and remain only LOCK_SH
to force current thread to wait until it will be able to make shared lock.
In current MR's code current thread will build schema again and write it to file again.
@wapmorgan hi, the first commit was OK. Could you revert the last change?
Set a shared lock on a file in Memoty::loadData() to prevent reading an empty file while writing it in concurrent worker/process
file_put_contents
in\Spiral\Boot\Memory::saveData=>\Spiral\Files\Files::write
created, but not completed write to fileGot this problem when 2 jobs consumers concurrently started writing/reading runtime/cache/cycle.php file. First consumer writing schema to the file, second consumers find out that files exists and read it, but it still was empty = so read empty schema.