You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.1 KiB

3 months ago
using System.Collections.Concurrent;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Job;
using log4net;
using Service.WaterCool.Client;
namespace Service.Job;
/// <summary>
3 months ago
/// 每秒发送水冷
3 months ago
/// </summary>
[Scope]
public class SendWaterCoolJob : AbstractCronJob
{
private static readonly ILog Log = LogManager.GetLogger(typeof(SendWaterCoolJob));
protected override Task Handle()
{
ConcurrentDictionary<string, WaterCoolClient> waterCool = WaterCoolClientMgr.Dictionary;
if (waterCool.Values.Count <= 0)
{
return Task.CompletedTask;
}
foreach (var waterCoolClient in waterCool)
{
WaterCoolClient client = waterCoolClient.Value;
if (client.IsConnect && client.IsWaterCoolSend)
{
client.Send();
}
}
3 months ago
Log.Info($"水冷发送成功");
3 months ago
return Task.CompletedTask;
}
protected override string Key()
{
return "SendWaterCoolJob";
}
protected override string Cron()
{
return "* * * * * ? *";
}
}