using System;
using System.Threading.Tasks;
using Wicture.DbRESTFul;

namespace JiaZhiQuan.Common.Config
{
    public class ConfigRefreshScheduleService : AbstractControlledScheduleService
    {
        ConfigFromDb configFromDb;

        public ConfigRefreshScheduleService(ConfigFromDb configFromDb) : base(30 * 1000, false)
        {
            this.configFromDb = configFromDb;
            IgnoreStateConfig = true;
        }

        override public async Task Run()
        {
            try
            {
                configFromDb.Resolve();
            }
            catch (Exception ex)
            {
                LoggerManager.Logger.Error(ex, "刷新ConfigFromDB配置失败" + "\r\n" + ex.Message);
            }
            await Task.CompletedTask;
        }

    }
}
