コード例 #1
0
 public WsServerNodeAddressSet(IWsServerNodeRedis wsServerNodeRedis) : base(wsServerNodeRedis)
 {
     VirtualRoot.BuildEventPath <Per5MinuteEvent>("清理掉离线的WsServer节点", LogEnum.None, this.GetType(), PathPriority.Normal, path: message => {
         wsServerNodeRedis.GetAllAddress().ContinueWith(t => {
             var offlines = t.Result.Where(a => IsOffline(a.Value, message.BornOn)).Select(a => a.Key).ToArray();
             if (offlines != null && offlines.Length != 0)
             {
                 wsServerNodeRedis.ClearAsync(offlines).ContinueWith(_ => {
                     NTMinerConsole.UserWarn($"清理了 {offlines.Length.ToString()} 条");
                 });
             }
         });
     });
 }
コード例 #2
0
 public WsServerNodeAddressSet(IWsServerNodeRedis wsServerNodeRedis) : base(wsServerNodeRedis)
 {
     VirtualRoot.AddEventPath <Per10SecondEvent>("清理掉离线的WsServer节点", LogEnum.UserConsole, action: message => {
         wsServerNodeRedis.GetAllAddress().ContinueWith(t => {
             var offlines = GetOfflineAddress(t.Result);
             if (offlines != null && offlines.Count != 0)
             {
                 wsServerNodeRedis.ClearAsync(offlines).ContinueWith(_ => {
                     NTMinerConsole.UserWarn($"清理了 {offlines.Count} 条");
                 });
             }
         });
     }, this.GetType());
 }