This commit is contained in:
2021-12-01 19:05:00 +08:00
parent b0f70a13da
commit abe2dad521
+23 -2
View File
@@ -3,8 +3,6 @@
defined('APP_PATH') or define('APP_PATH', realpath(__DIR__ . '/../../'));
use Note\Note;
use Note\Route\Route;
use Http\Handler\Router;
use JetBrains\PhpStorm\Pure;
use Kiri\Abstracts\Config;
@@ -16,6 +14,8 @@ use Kiri\Events\EventDispatch;
use Kiri\Events\EventProvider;
use Kiri\Exception\ConfigException;
use Kiri\Kiri;
use Note\Note;
use Note\Route\Route;
use Psr\Log\LoggerInterface;
use Swoole\Process;
use Swoole\WebSocket\Server;
@@ -900,6 +900,27 @@ if (!function_exists('di')) {
}
if (!function_exists('interval')) {
/**
* @param callable $callback
* @param int $interval
* @param bool $is
*/
function interval(callable $callback, int $interval = 1000, bool $is = false)
{
usleep($interval * 1000);
$callback();
interval($callback, $interval, $is);
}
}
if (!function_exists('duplicate')) {