]> git.mxchange.org Git - friendica.git/commitdiff
Wait for parent
authorMichael <heluecht@pirati.ca>
Tue, 5 Jan 2021 16:47:55 +0000 (16:47 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 5 Jan 2021 16:47:55 +0000 (16:47 +0000)
src/Core/Worker.php

index 619cb5bfa32957d73ed9ec780c4cdeb9599c0ddc..d2468a2a804bf1f427108a48f9f196c0cae03fb9 100644 (file)
@@ -1234,9 +1234,13 @@ class Worker
                // We now are in the new worker
                DBA::connect();
                /// @todo Reinitialize the logger to set a new process_id and uid
-               
-               self::IPCSetJobState(true, getmypid());
-               Logger::info('Worker spawned', ['pid' => getmypid()]);
+
+               $cycles = 0;
+               while (!self::IPCJobsExists($pid) && (++$cycles < 100)) {
+                       usleep(10000);
+               }
+
+               Logger::info('Worker spawned', ['pid' => getmypid(), 'wait_cycles' => $cycles]);
 
                self::processQueue($do_cron);