带有时区并节省时间的nodejs计划

问题描述

我正在尝试使用node-sched计划在nodejs上进行一些工作(我也尝试了node-cron-tz支持时区),在我当前的开发机器上,它可以正常工作并且可以正常工作..在客户测试/ prod env会在2小时后执行它。

我需要在数据库上存在的时间执行此工作,通常是0 8 * * *

我在最新测试中使用的代码是

scheduleService.addSqlTask = function (item) {
    if (item == null)
        return;

    logger.info('Adding job {Item} to schedule',{Item:item.stored_procedure});
    //logger.info("Adding {Item} : {Cron}  to tasks",{ Item: item.stored_procedure,Cron : item.cron_tab });
    cron.schedule(item.cron_tab,async () => {
            try {
                logger.info("Executing {Item} to schedule",{ Item: item.stored_procedure });
                await dataStore.executeSql(item);
            } catch (e) {
                logger.error(e.message);
            }
        },{
            scheduled: true,timezone: "Europe/Rome"
        }
    );
}

在这种情况下,它甚至在我的机器上也无法正常工作,因为它不考虑节省光线...

我该如何处理?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...