public void Swoole\Server::defer ( callable $callback )
Delay execution of the callback function at the end of current EventLoop. Alias of function swoole_event_defer().
$callback
the function that defers to executevoid
<?php
function query($server, $db) {
$server->defer(function() use ($db) {
$db->close();
});
}