Created
July 28, 2022 17:57
-
-
Save kandy/d0d4907c0d653839f7b78cc0f64faf14 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Co; | |
if (!function_exists('go')) { | |
function go($f) { $f(); } | |
function run($f) { $f(); } | |
} else { | |
\Co::set(['hook_flags' => SWOOLE_HOOK_TCP]); | |
} | |
echo "Start time: ", date(DATE_ATOM), PHP_EOL; | |
run(function() { | |
foreach (range(0,30) as $line) { | |
go(function () { | |
$pdo = new \PDO( | |
"mysql:host=db;dbname=magento2", | |
'root', | |
'root' | |
); | |
return $pdo->query('select sleep(1)')->fetch(); | |
}); | |
} | |
}); | |
echo "End time: ", date(DATE_ATOM), PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment