<?php

namespace app\process;

use app\common\service\GameLiveService;
use Workerman\Timer;

/**
 * 实时对局：按单局时长自动开奖
 */
class GameLiveTicker
{
    public function onWorkerStart(): void
    {
        GameLiveService::recoverAbnormalPeriodOnStartup();

        Timer::add(1, static function (): void {
            GameLiveService::finalizePayoutGrace();
            GameLiveService::tickAutoDraw();
            GameLiveService::publishSnapshot(null);
        });
    }
}
