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.
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
using HybirdFrameworkCore.Job;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Service.WaterCool.Client;
|
|
|
|
|
|
|
|
|
|
namespace Service.Job;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 每秒发送水冷
|
|
|
|
|
/// </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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Log.Info($"水冷发送成功");
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Key()
|
|
|
|
|
{
|
|
|
|
|
return "SendWaterCoolJob";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Cron()
|
|
|
|
|
{
|
|
|
|
|
return "* * * * * ? *";
|
|
|
|
|
}
|
|
|
|
|
}
|