【发布时间】:2020-12-01 04:11:29
【问题描述】:
我正在尝试构建一个服务,使其每天在特定时间运行一次,以尽量减少使用服务结构对数据库的多次调用
【问题讨论】:
标签: azure-service-fabric service-fabric-actor
我正在尝试构建一个服务,使其每天在特定时间运行一次,以尽量减少使用服务结构对数据库的多次调用
【问题讨论】:
标签: azure-service-fabric service-fabric-actor
您可以使用Actor reminders
您需要调用 RegisterReminderAsync。每 24 小时运行一次
var reminderRegistration = await this.RegisterReminderAsync(
reminderName,
BitConverter.GetBytes(amountInDollars),
TimeSpan.FromMinutes(0), //The amount of time to delay before firing the reminder
TimeSpan.FromHours(24)); //The time interval between firing of reminders
如果您想在特定时间运行,您可以每小时/ x 分钟触发一次,并在该方法中检查 DateTime.UtcNow 是否在正确的窗口中。
【讨论】: