Documentation
use crate::card_service::replay::IRePlayClickHouseDB;
use crate::static_def::REPLAY_DB;
use crate::timer::Timer;

/// 提交回放数据
pub struct CommitReplayTimer;

#[async_trait::async_trait]
impl Timer for CommitReplayTimer {
    /// 每10秒检查一次
    #[inline]
    async fn init(&self) -> anyhow::Result<(bool, u64)> {
        Ok((false, 5000))
    }

    #[inline]
    async fn run(&self) -> anyhow::Result<()> {
        REPLAY_DB.commit().await?;
        Ok(())
    }
}