Esempio n. 1
0
 public UserSet(IUserRedis redis, IUserMqSender mqSender) : base(redis)
 {
     _redis    = redis;
     _mqSender = mqSender;
     VirtualRoot.AddCmdPath <UpdateUserRSAKeyMqMessage>(action: message => {
         if (message.AppId == ServerRoot.HostConfig.ThisServerAddress)
         {
             return;
         }
         if (string.IsNullOrEmpty(message.LoginName))
         {
             return;
         }
         if (IsOldMqMessage(message.Timestamp))
         {
             Write.UserOk(_safeIgnoreMessage);
             return;
         }
         if (message.Key != null && _dicByLoginName.TryGetValue(message.LoginName, out UserData userData))
         {
             userData.Update(message.Key);
             redis.SetAsync(userData).ContinueWith(t => {
                 _mqSender.SendUserRSAKeyUpdated(message.LoginName);
             });
         }
     }, this.GetType(), LogEnum.DevConsole);
 }