/** * [init 启动定时器] * @return [type] [description] */ public static function init() { if (!isset(self::$tickKey)) { self::$tickKey = swoole_timer_tick(1000 * self::LOOPTIME, function () { //循环数组,踢出超时情况 self::loop(); }); \SysLog::info(__METHOD__ . " init timer tick key == " . self::$tickKey, __CLASS__); } }
/** * [init 启动定时器] * @return [type] [description] */ public static function init() { if (!self::$isOnTimer) { swoole_timer_after(1000 * self::LOOPTIME, function () { //循环数组,踢出超时情况 self::loop(); self::$isOnTimer = false; }); self::$isOnTimer = true; } }