优化定时任务发送

This commit is contained in:
ChenYi 2025-03-18 17:10:54 +08:00
parent 8334b5ee49
commit 69cad7bdee
2 changed files with 4 additions and 3 deletions

View File

@ -398,7 +398,8 @@ namespace JiShe.CollectBus.ScheduledMeterReading
{
foreach (var ammerterItem in focusItem.Value)
{
_= _capBus.PublishAsync(ProtocolConst.AmmeterSubscriberWorkerFifteenMinuteIssuedEventName, ammerterItem.Value);
//todo 可能需要优化如果使用等待会很慢但使用不等待mongodb 连接池又没法抗住,先发送微妙级的延时队列消息,暂时先这样处理
_= _capBus.PublishDelayAsync(TimeSpan.FromMicroseconds(500), ProtocolConst.AmmeterSubscriberWorkerFifteenMinuteIssuedEventName, ammerterItem.Value);
meterTaskInfosList.Add(ammerterItem.Value);
}
}
@ -408,7 +409,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
}
//删除任务数据
await FreeRedisProvider.Instance.DelAsync(redisKeyList);
await FreeRedisProvider.Instance.DelAsync(oneMinutekeyList);
//缓存下一个时间的任务
TasksToBeIssueModel nextTask = new TasksToBeIssueModel()

View File

@ -11,7 +11,7 @@ namespace JiShe.CollectBus.Common.Consts
/// <summary>
/// 缓存基础目录
/// </summary>
public const string CacheBasicDirectoryKey = "CollectBus";
public const string CacheBasicDirectoryKey = "CollectBus:";
/// <summary>
/// 1分钟采集间隔