{"id":285466,"date":"2017-04-25T10:10:19","date_gmt":"2017-04-25T06:10:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=285466"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=285466","title":{"rendered":"\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c1c\/007\/ca9\/c1c007ca94e40da77659a0c2bb9e46df.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0412\u044b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d\u0435, \u043d\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e? \u0411\u044b\u0432\u0430\u0435\u0442, \u0438\u0437\u0443\u0447\u0430\u0435\u0448\u044c \u0442\u0430\u043a\u043e\u0439 \u0431\u0430\u0433 \u0438 \u0432\u0434\u0440\u0443\u0433 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0448\u044c, \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u0418\u0437\u0443\u0447\u0438\u0432 \u043a\u043e\u0434, \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0448\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u043b\u043e\u0441\u044c. \u041d\u043e \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u2026<\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0441\u0432\u043e\u0435\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439. \u0410 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0445 (\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0434\u0430\u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445) \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0431\u0430\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430. \u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0430\u0433\u043e\u0432 \u0436\u0438\u0432\u044b\u0435 \u2014 \u0442\u043e, \u0447\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0441\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 github, \u043a\u0443\u0434\u0430 \u044f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043b\u0435\u0433\u043a\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e.<br \/>  <a name=\"habracut\"><\/a><\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u043e\u043c\u0435\u0440 \u043e\u0434\u0438\u043d. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435<\/h3>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 (PostgreSQL) \u0438 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0430\u043b\u0430\u0434\u0438\u0442\u044c \u0438\u043c\u043f\u043e\u0440\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 <code>account (id, name)<\/code> \u0438 \u0441\u0432\u044f\u0437\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0441 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>account_import (id, external_id)<\/code>. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0440\u0438\u0435\u043c\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u041f\u0440\u0438 \u043f\u0440\u0438\u0435\u043c\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u043c \u0441\u043f\u0435\u0440\u0432\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u2014 \u0435\u0441\u0442\u044c \u043b\u0438 \u0442\u0430\u043a\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0443 \u043d\u0430\u0441 \u0432 \u0431\u0430\u0437\u0435. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0431\u0430\u0437\u0443.<\/p>\n<pre><code class=\"php\">$data = json_decode($jsonInput, true); \/\/ '{&quot;id&quot;:1,&quot;name&quot;:&quot;account1&quot;}'  try {     $connection-&gt;beginTransaction();      \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0442\u0430\u043a\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0431\u0430\u0437\u0435     $stmt = $connection-&gt;prepare(&quot;SELECT id FROM account_import          WHERE external_id = :external_id&quot;);     $stmt-&gt;execute([         ':external_id' =&gt; $data['id'],     ]);     $row = $stmt-&gt;fetch();      usleep(100000); \/\/ 0.1 sec      \/\/ \u0415\u0441\u043b\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0431\u0430\u0437\u0435 \u0435\u0441\u0442\u044c, \u0442\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0435\u0435     if ($row) {         $stmt = $connection-&gt;prepare(&quot;UPDATE account SET name = :name WHERE id = (             SELECT id FROM account_import WHERE external_id = :external_id         )&quot;);         $stmt-&gt;execute([             ':name' =&gt; $data['name'],             ':external_id' =&gt; $data['id'],         ]);         $accountId = $row['id'];     }     \/\/ \u0418\u043d\u0430\u0447\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c     else {         $stmt = $connection-&gt;prepare(&quot;INSERT INTO account (name) VALUES (:name)&quot;);         $stmt-&gt;execute([             ':name' =&gt; $data['name'],         ]);         $accountId = $connection-&gt;lastInsertId();          $stmt = $connection-&gt;prepare(&quot;INSERT INTO account_import (id, external_id)              VALUES (:id, :external_id)&quot;);         $stmt-&gt;execute([             ':id' =&gt; $accountId,             ':external_id' =&gt; $data['id'],         ]);     }      $connection-&gt;commit(); } catch (\\Throwable $e) {     $connection-&gt;rollBack();     throw $e; }<\/code><\/pre>\n<p>  \u0421 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0430\u0448\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043c\u043e\u0433\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u0443\u0442 \u043c\u043e\u0436\u0435\u043c \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439. \u0417\u0430\u0434\u0435\u0440\u0436\u043a\u0430 0.1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0438\u043c\u043f\u043e\u0440\u0442 \u043e\u0434\u043d\u0438\u0445 \u0438 \u0442\u0435\u0445 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e? \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b, \u0430 \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u044b, \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0439 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 account_import. <\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443, \u0435\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0431\u044b \u0441\u043f\u0435\u0440\u0432\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438. \u0410 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443. \u042f \u0440\u0435\u0448\u0438\u043b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e bash \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 PHP.<\/p>\n<p>  \u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430 \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432 \u0444\u043e\u043d\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434, \u043f\u043e\u0442\u043e\u043c \u0436\u0434\u0435\u043c \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0442\u0441\u044f, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0434\u043e\u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0442 \u043d\u0443\u043b\u044f, \u0437\u043d\u0430\u0447\u0438\u0442 \u043c\u044b \u043d\u0430\u0448\u043b\u0438 \u0431\u0430\u0433. \u0412 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0441\u043a\u0440\u0438\u043f\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\"># \u041a\u043e\u043c\u0430\u043d\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c COMMAND=\u201decho -e '{\\&quot;id\\&quot;:1,\\&quot;name\\&quot;:\\&quot;account1\\&quot;}' | .\/cli app:import\u201d  # PID-\u044b \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u0445 \u0444\u043e\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 pids=()  # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u043e\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 results=()  # \u041e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u043e\u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 (\u043d\u0443\u043b\u0438) expects=()  # \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0444\u043e\u043d\u0435 \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u043c \u0432\u044b\u0432\u043e\u0434 \u0432 stderr for i in $(seq 2) do   eval $COMMAND 1&gt;&2 & pids+=($!) ; echo -e '&gt;&gt;&gt;' Process ${pids[i-1]} started 1&gt;&2 done  # \u041e\u0436\u0438\u0434\u0430\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 $results for pid in &quot;${pids[@]}&quot; do   wait $pid   results+=($?)   expects+=(0)   echo -e '&lt;&lt;&lt;' Process $pid finished 1&gt;&2 done  # \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c\u0438 result=`( IFS=$', '; echo &quot;${results[*]}&quot; )` expect=`( IFS=$', '; echo &quot;${expects[*]}&quot; )` if [ &quot;$result&quot; != &quot;$expect&quot; ] then   exit 1 fi<\/code><\/pre>\n<p>  \u041f\u043e\u043b\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 <a href=\"https:\/\/github.com\/mnvx\/pprocess\/blob\/master\/bin\/pprocess\">\u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043d\u0430 github<\/a>.<\/p>\n<p>  \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a PHPUnit \u043d\u043e\u0432\u044b\u0435 assert-\u044b. \u0422\u0443\u0442 \u0443\u0436\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u0449\u0435 \u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u043c. \u0421\u043a\u0430\u0436\u0443 \u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0432 \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u043d\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b. \u0427\u0442\u043e\u0431\u044b \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u0440\u0435\u0439\u0442 <code>AsyncTrait<\/code> \u043a \u0432\u0430\u0448\u0435\u043c\u0443 \u0442\u0435\u0441\u0442\u0443.<\/p>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0442\u0435\u0441\u0442.<\/p>\n<pre><code class=\"php\">use App\\Command\\Initializer; use Mnvx\\PProcess\\AsyncTrait; use Mnvx\\PProcess\\Command\\Command; use PHPUnit\\Framework\\TestCase; use Symfony\\Component\\Console\\Tester\\CommandTester;  class ImportCommandTest extends TestCase {     use AsyncTrait;      public function testImport()     {         $cli = Initializer::create();         $command = $cli-&gt;find('app:delete');          \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c c external_id = 1,          \/\/ \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0437\u0430\u043f\u0438\u0441\u0438         $commandTester = new CommandTester($command);         $commandTester-&gt;execute([             'externalId' =&gt; 1,         ]);          $asnycCommand = new Command(             'echo -e \\'{&quot;id&quot;:1,&quot;name&quot;:&quot;account1&quot;}\\' | .\/cli app:import', \/\/ \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430             dirname(__DIR__), \/\/ \u041a\u0430\u0442\u0430\u043b\u043e\u0433, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430             2 \/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434         );         \/\/ \u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438         $this-&gt;assertAsyncCommand($asnycCommand);     } }<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0432\u043e\u0434.<\/p>\n<pre><code>$ .\/vendor\/bin\/phpunit PHPUnit 6.1.1 by Sebastian Bergmann and contributors.  F                                                                   1 \/ 1 (100%)  Time: 230 ms, Memory: 6.00MB  There was 1 failure:  1) ImportCommandTest::testImport Failed asserting that command  \techo -e '{&quot;id&quot;:1,&quot;name&quot;:&quot;account1&quot;}' | .\/cli app:import (path: \/var\/www\/pprocess-playground, count: 2) executed in parallel. Output:   &gt;&gt;&gt; Process 18143 started &gt;&gt;&gt; Process 18144 started Account 25 imported correctly                                                                                    [Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException]                    An exception occurred while executing 'INSERT INTO account_import (id, exte     rnal_id) VALUES (:id, :external_id)' with params [&quot;26&quot;, 1]:                     SQLSTATE[23505]: Unique violation: 7 \u041e\u0428\u0418\u0411\u041a\u0410:  \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0435\u0435\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430      \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 &quot;account_import_pkey&quot;                         DETAIL:  \u041a\u043b\u044e\u0447 &quot;(external_id)=(1)&quot; \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.                                                                                                             -------  app:import  &lt;&lt;&lt; Process 18143 finished  &lt;&lt;&lt; Process 18144 finished   .  \/var\/www\/pprocess-playground\/vendor\/mnvx\/pprocess\/src\/AsyncTrait.php:19 \/var\/www\/pprocess-playground\/tests\/ImportCommandTest.php:30  FAILURES! Tests: 1, Assertions: 1, Failures: 1.<\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0447\u0438\u043d\u0443 \u043c\u044b \u0443\u0436\u0435 \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 (\u0442\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/malkusch\/lock\">malkusch\/lock<\/a>).<\/p>\n<pre><code class=\"php\">$mutex = new FlockMutex(fopen(__FILE__, 'r')); $mutex-&gt;synchronized(function () use ($connection, $data) {     \/\/ \u043d\u0430\u0448 \u043a\u043e\u0434 \u0438\u0437 \u0431\u043b\u043e\u043a\u0430 try }); <\/code><\/pre>\n<p>  \u0422\u0435\u0441\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u043d:<\/p>\n<pre><code>$ .\/vendor\/bin\/phpunit PHPUnit 6.1.1 by Sebastian Bergmann and contributors.  .                                                                   1 \/ 1 (100%)  Time: 361 ms, Memory: 6.00MB  OK (1 test, 1 assertion)<\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u044f <a href=\"https:\/\/github.com\/mnvx\/pprocess-playground\">\u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043d\u0430 github<\/a>, \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u043e\u043c\u0435\u0440 \u0434\u0432\u0430. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435<\/h3>\n<p>  \u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 <code>users (id, name)<\/code> \u0438 \u043c\u044b \u0436\u0435\u043b\u0430\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>users_active (id)<\/code> \u0441\u043f\u0438\u0441\u043e\u043a \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<\/p>\n<p>  \u0423 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b <code>users_acitve<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0443\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043d\u043e\u0432\u043e.<\/p>\n<pre><code class=\"php\">try {     $connection-&gt;beginTransaction();      $connection-&gt;prepare(&quot;DELETE FROM users_active&quot;)-&gt;execute();      usleep(100000); \/\/ 0.1 sec      $connection-&gt;prepare(&quot;INSERT INTO users_active (id) VALUES (3), (5), (6), (10)&quot;)-&gt;execute();      $connection-&gt;commit();     $output-&gt;writeln('&lt;info&gt;users_active refreshed&lt;\/info&gt;'); } catch (\\Throwable $e) {     $connection-&gt;rollBack();     throw $e; }<\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0437\u0433\u043b\u044f\u0434\u0430 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0436\u0435 \u0434\u0435\u043b\u0435 \u043f\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441\u043d\u043e\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442, \u0447\u0442\u043e\u0431\u044b \u0435\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438.<\/p>\n<pre><code class=\"php\">use Mnvx\\PProcess\\AsyncTrait; use Mnvx\\PProcess\\Command\\Command; use PHPUnit\\Framework\\TestCase;  class DetectActiveUsersCommandTest extends TestCase {     use AsyncTrait;      public function testImport()     {         $asnycCommand = new Command(             '.\/cli app:detect-active-users', \/\/ \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430             dirname(__DIR__), \/\/ \u041a\u0430\u0442\u0430\u043b\u043e\u0433, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430             2 \/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434         );         \/\/ \u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438         $this-&gt;assertAsyncCommand($asnycCommand);     } }<\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442 \u0438 \u0432\u0438\u0434\u0438\u043c \u0442\u0435\u043a\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<pre><code>$ .\/vendor\/bin\/phpunit tests\/DetectActiveUsersCommandTest.php PHPUnit 6.1.1 by Sebastian Bergmann and contributors.  F                                                                   1 \/ 1 (100%)  Time: 287 ms, Memory: 4.00MB  There was 1 failure:  1) DetectActiveUsersCommandTest::testImport Failed asserting that command  \t.\/cli app:detect-active-users (path: \/var\/www\/pprocess-playground, count: 2) executed in parallel. Output:   &gt;&gt;&gt; Process 24717 started &gt;&gt;&gt; Process 24718 started users_active refreshed &lt;&lt;&lt; Process 24717 finished                                                                                     [Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException]                    An exception occurred while executing 'INSERT INTO users_active (id) VALUES      (3), (5), (6), (10)':                                                          SQLSTATE[23505]: Unique violation: 7 \u041e\u0428\u0418\u0411\u041a\u0410:  \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0435\u0435\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0430      \u043d\u0430\u0440\u0443\u0448\u0430\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 &quot;users_active_pkey&quot;                           DETAIL:  \u041a\u043b\u044e\u0447 &quot;(id)=(3)&quot; \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442.                                       -------  app:detect-active-users  &lt;&lt;&lt; Process 24718 finished   .  \/var\/www\/pprocess-playground\/vendor\/mnvx\/pprocess\/src\/AsyncTrait.php:19 \/var\/www\/pprocess-playground\/tests\/DetectActiveUsersCommandTest.php:19  FAILURES! Tests: 1, Assertions: 1, Failures: 1.<\/code><\/pre>\n<p>  \u041f\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0441\u043d\u043e\u0432\u0430 INSERT \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0438 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u0430\u0440\u0442\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"php\">$connection-&gt;prepare(&quot;SELECT id FROM users_active FOR UPDATE&quot;)-&gt;execute(); <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442 \u2014 \u043e\u0448\u0438\u0431\u043a\u0430 \u0443\u0448\u043b\u0430. \u041d\u0430\u0448 \u0442\u0435\u0441\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0434\u0432\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043c \u0432 \u043d\u0430\u0448\u0435\u043c \u0442\u0435\u0441\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0434\u043e 3-\u0445 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442.<\/p>\n<pre><code class=\"php\">$asnycCommand = new Command(     '.\/cli app:detect-active-users', \/\/ \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430     dirname(__DIR__), \/\/ \u041a\u0430\u0442\u0430\u043b\u043e\u0433, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430     3 \/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434 ); <\/code><\/pre>\n<p>  \u0418 \u0441\u043d\u043e\u0432\u0430 \u0438\u043c\u0435\u0435\u043c \u0442\u0443 \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u0443. \u0412 \u0447\u0435\u043c \u0434\u0435\u043b\u043e, \u043c\u044b \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443?! \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0432, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 <code>users_active<\/code> \u0435\u0441\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 3 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u0430 \u0442\u0430\u043a\u0430\u044f \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443. \u0412\u0442\u043e\u0440\u043e\u0439 \u0438 \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0436\u0434\u0443\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430, \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438 \u0442\u0440\u0435\u0442\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043d\u0435\u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0447\u0438\u043d\u0438\u0442\u044c, \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0443\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,<\/p>\n<pre><code class=\"php\">$connection-&gt;prepare(&quot;SELECT id FROM users WHERE id IN (3, 5, 6, 10) FOR UPDATE&quot;)-&gt;execute();<\/code><\/pre>\n<p>  \u041b\u0438\u0431\u043e \u0432\u043c\u0435\u0441\u0442\u043e <code>DELETE<\/code> \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <code>TRUNCATE<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0432\u0441\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u043e\u043c\u0435\u0440 \u0442\u0440\u0438. Deadlock<\/h3>\n<p>  \u0411\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c, \u043d\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0441 \u043e\u0434\u043d\u0438\u043c\u0438 \u0438 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c. \u041d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0442\u0430\u043a\u0438\u0445 \u0431\u0430\u0433\u043e\u0432 \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0435\u043b\u0435\u0433\u043a\u043e. \u041d\u043e \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430, \u0442\u043e \u0442\u0435\u0441\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0441\u0442\u043e\u0438\u0442, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 \u043a\u043e\u0434.<\/p>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0430\u0440\u0443 \u0442\u0430\u043a\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434. \u042d\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043d\u0430\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043f\u0435\u0440\u0432\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0441 id=1, \u043f\u043e\u0442\u043e\u043c \u0441 id=2.<\/p>\n<pre><code class=\"php\">try {     $connection-&gt;beginTransaction();      $connection-&gt;prepare(&quot;UPDATE deadlock SET value = value + 1 WHERE id = 1&quot;)-&gt;execute();      usleep(100000); \/\/ 0.1 sec      $connection-&gt;prepare(&quot;UPDATE deadlock SET value = value + 1 WHERE id = 2&quot;)-&gt;execute();      $connection-&gt;commit();     $output-&gt;writeln('&lt;info&gt;Completed without deadlocks&lt;\/info&gt;'); } catch (\\Throwable $e) {     $connection-&gt;rollBack();     throw $e; }<\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043f\u0435\u0440\u0432\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0441 id=2, \u043f\u043e\u0442\u043e\u043c \u0441 id=1.<\/p>\n<pre><code class=\"php\">try {     $connection-&gt;beginTransaction();      $connection-&gt;prepare(&quot;UPDATE deadlock SET value = value + 1 WHERE id = 2&quot;)-&gt;execute();      usleep(100000); \/\/ 0.1 sec      $connection-&gt;prepare(&quot;UPDATE deadlock SET value = value + 1 WHERE id = 1&quot;)-&gt;execute();      $connection-&gt;commit();     $output-&gt;writeln('&lt;info&gt;Completed without deadlocks&lt;\/info&gt;'); } catch (\\Throwable $e) {     $connection-&gt;rollBack();     throw $e; }<\/code><\/pre>\n<p>  \u0422\u0435\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a.<\/p>\n<pre><code class=\"php\">use Mnvx\\PProcess\\AsyncTrait; use Mnvx\\PProcess\\Command\\CommandSet; use PHPUnit\\Framework\\TestCase;  class DeadlockCommandTest extends TestCase {     use AsyncTrait;      public function testImport()     {         $asnycCommand = new CommandSet(             [   \/\/ \u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b                 '.\/cli app:deadlock-one',                 '.\/cli app:deadlock-two'             ],             dirname(__DIR__), \/\/ \u041a\u0430\u0442\u0430\u043b\u043e\u0433, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430             1 \/\/ \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0445 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043a\u043e\u043c\u0430\u043d\u0434         );         \/\/ \u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438         $this-&gt;assertAsyncCommands($asnycCommand);     } }<\/code><\/pre>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0430 \u0443\u0432\u0438\u0434\u0438\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<pre><code>$ .\/vendor\/bin\/phpunit tests\/DeadlockCommandTest.php PHPUnit 6.1.1 by Sebastian Bergmann and contributors.  F                                                                   1 \/ 1 (100%)  Time: 1.19 seconds, Memory: 4.00MB  There was 1 failure:  1) DeadlockCommandTest::testImport Failed asserting that commands  \t.\/cli app:deadlock-one, .\/cli app:deadlock-two (path: \/var\/www\/pprocess-playground, count: 1) executed in parallel. Output:   &gt;&gt;&gt; Process 5481 started: .\/cli app:deadlock-one &gt;&gt;&gt; Process 5481 started: .\/cli app:deadlock-two                                                                                    [Doctrine\\DBAL\\Exception\\DriverException]                                       An exception occurred while executing 'UPDATE deadlock SET value = value +      1 WHERE id = 1':                                                                SQLSTATE[40P01]: Deadlock detected: 7 \u041e\u0428\u0418\u0411\u041a\u0410:  \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430      DETAIL:  \u041f\u0440\u043e\u0446\u0435\u0441\u0441 5498 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 ShareLock \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 &quot;\u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f 294     738&quot;; \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c 5499.                                              \u041f\u0440\u043e\u0446\u0435\u0441\u0441 5499 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 ShareLock \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 &quot;\u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f 294737&quot;; \u0437\u0430\u0431     \u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c 5498.                                                       HINT:  \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.                        CONTEXT:  \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 (0,48) \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 &quot;deadlock&quot;                  -------  app:deadlock-two  Completed without deadlocks &lt;&lt;&lt; Process 5481 finished  &lt;&lt;&lt; Process 5484 finished   .  \/var\/www\/pprocess-playground\/vendor\/mnvx\/pprocess\/src\/AsyncTrait.php:39 \/var\/www\/pprocess-playground\/tests\/DeadlockCommandTest.php:22  FAILURES! Tests: 1, Assertions: 1, Failures: 1.<\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043b\u0435\u0447\u0438\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u043f\u0435\u0440\u0432\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c. \u041b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u0441\u043c\u043e\u0442\u0440\u043e\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u0430\u0437\u044b \u0438\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<h3>\u0420\u0435\u0437\u044e\u043c\u0438\u0440\u0443\u0435\u043c<\/h3>\n<p>  \u041f\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043f\u0440\u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0442\u0435\u0441\u0442\u044b, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c <a href=\"https:\/\/github.com\/mnvx\/pprocess\">pprocess<\/a>.<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/327292\/\"> https:\/\/habrahabr.ru\/post\/327292\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/c1c\/007\/ca9\/c1c007ca94e40da77659a0c2bb9e46df.jpg\" alt=\"image\"\/><\/p>\n<p>  \u0412\u044b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d\u0435, \u043d\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e? \u0411\u044b\u0432\u0430\u0435\u0442, \u0438\u0437\u0443\u0447\u0430\u0435\u0448\u044c \u0442\u0430\u043a\u043e\u0439 \u0431\u0430\u0433 \u0438 \u0432\u0434\u0440\u0443\u0433 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0448\u044c, \u0447\u0442\u043e \u043e\u043d \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u0418\u0437\u0443\u0447\u0438\u0432 \u043a\u043e\u0434, \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0448\u044c \u043a\u0430\u043a \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u043b\u043e\u0441\u044c. \u041d\u043e \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u2026<\/p>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0441\u0432\u043e\u0435\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439. \u0410 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0445 (\u0438 \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0434\u0430\u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445) \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0431\u0430\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430. \u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0430\u0433\u043e\u0432 \u0436\u0438\u0432\u044b\u0435 \u2014 \u0442\u043e, \u0447\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u0431\u043e\u0442\u0435.<\/p>\n<p>  \u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0441\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 github, \u043a\u0443\u0434\u0430 \u044f \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043b\u0435\u0433\u043a\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-285466","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=285466"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/285466\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=285466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=285466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=285466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}