AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

[Bug] cron定时任务 webui中的“最近执行”一列的时间/时区设置存在问题

Open FFFold opened this issue 8 months ago • 5 comments

What happened / 发生了什么

cron定时任务webui中的“最近执行”一列还存在时区与系统配置不一致的问题(见图1)。显示为2026/3/13 14:00:00触发,实为2026/3/13 22:00:00触发。

bot部署在Ubuntu Server LTS 24.04的Docker容器中,检查了bot配置中的时区设置、宿主机时区设置、Docker内部时区设置,显示均正常(UTC+8/CST)。(见图2、3、4)

Image Image Image Image

Reproduce / 如何复现?

设置重复性定时任务即可

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

部署在Docker 宿主机:Ubuntu Server LTS 24.04 astrbot版本:4.20.0

OS

Linux

Logs / 报错日志

无日志输出

Image

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • [ ] Yes!

Code of Conduct

FFFold avatar Mar 14 '26 03:03 FFFold

这是一个已知的时区处理问题。根本原因在于数据流中的时区转换:

问题分析:

多位用户报告过类似的 8 小时偏移问题,这在容器部署中是已知问题。

临时解决方案(Docker 部署):

-v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro

或在容器内安装 tzdata 并设置 Asia/Shanghai 时区。

这可能需要代码层面修复,确保后端在序列化时正确处理时区转换,或前端正确解析带时区的 ISO 字符串。

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about AstrBot Share Dosu with your team

dosubot[bot] avatar Mar 14 '26 03:03 dosubot[bot]

这是一个已知的时区处理问题。根本原因在于数据流中的时区转换:

问题分析:

多位用户报告过类似的 8 小时偏移问题,这在容器部署中是已知问题。

临时解决方案(Docker 部署):

-v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro 或在容器内安装 tzdata 并设置 Asia/Shanghai 时区。

这可能需要代码层面修复,确保后端在序列化时正确处理时区转换,或前端正确解析带时区的 ISO 字符串。

To reply, just mention @dosu.

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Open in Cursor Join Discord Share on X

bot所引issue均与此issue情况不符,https://github.com/AstrBotDevs/AstrBot/issues/4774 提到的日志问题在我这里并不存在。https://github.com/AstrBotDevs/AstrBot/issues/4613 是一款插件的发布请求,与此问题无关。

Image

FFFold avatar Mar 14 '26 03:03 FFFold

应该是时区未统一的问题,接口返回的 last_run_at 和 next_run_time 用了不同的时区处理,我来康康。

ginpika avatar Mar 14 '26 12:03 ginpika

已解决

FFFold avatar Apr 19 '26 11:04 FFFold

emm...现在是May 25,#6390 还没合并 现在Active Agent类型的任务还是没法正常触发呢 不过 [Bug]面板时间设置有问题 确实很好用

YoungUsing avatar May 25 '26 14:05 YoungUsing