使用Hangfire监控API获取所有成功的作业

问题描述 投票:1回答:1

我正在使用Hangfire中的JobStorage.Current.GetMonitoringApi()来获得所有成功任务的计数。为此,我正在使用以下功能:

var api = JobStorage.Current.GetMonitoringApi();
var succeededJobs = api.SucceededJobs(0, int.MaxValue);

但是,这似乎只返回最近几天的成功工作。就我而言,它返回95,但是如果您查看我的仪表板,则会看到更多。

enter image description here

是否可以通过MonitoringApi提取所有历史作业数据?

postgresql asp.net-core hangfire
1个回答
1
投票

解决方案是为每个作业设置JobExpirationTimeout属性,以防止过早从存储中将其删除。

可以用IApplyStateFilter完成。

请参阅:https://discuss.hangfire.io/t/how-to-configure-the-retention-time-of-job/34

© www.soinside.com 2019 - 2024. All rights reserved.