Extending the SqlServer driver for Hyperf ORM through AOP and simulating coroutines using the Task component.
composer require chance-fyi/hyperf-database-sqlserverConfigure a SQL Server connection in config/autoload/databases.php as usual.
Every query is dispatched to a task worker (to simulate coroutines over the
blocking PDO/ODBC driver), and that task has an execute timeout.
By default the task execute timeout is 10 seconds (the Hyperf Task default).
A heavy query that legitimately runs longer than 10s would otherwise fail with
Task [N] execute timeout. Raise it per connection with the task_timeout
option (in seconds):
// config/autoload/databases.php
return [
'sqlsrv' => [
'driver' => 'sqlsrv',
// host / database / username / password / ...
'task_timeout' => 60, // optional, seconds, default 10
],
];