denny 2 vuotta sitten
vanhempi
commit
a68f2cbc00

+ 4 - 8
src/InteractionCenter/FastestServerInteractionCenterService.cs

@@ -177,6 +177,7 @@ namespace WingCloudServer.InteractionCenter
                             tokenInfo.IpValue = IpToLong(requestIp);
                             var res = await _tokenDBService.UpdateTokenAsync(tokenInfo.Code, tokenInfo);
                             if (res) {
+                                _fastestServerManager.Remove(tokenInfo.Code);
                                 var msgContent = "{\"Result\":\"Success\"}";
                                 ResponseContent(context, true, msgContent);
                                 return;
@@ -332,7 +333,7 @@ namespace WingCloudServer.InteractionCenter
         private async Task<IList<ServerInformation>> GetServerInformationList(IList<string> ids) 
         {
             IList<ServerInformation> serverInformationList = new List<ServerInformation>();
-            if (ids?.Count > 0) {
+            if (ids == null || ids.Count <= 0) {
                 var request = new GetDistributedServerInfoDBPagesRequest(){
                     CurrentPage = 1,
                     PageSize = 1000
@@ -340,6 +341,7 @@ namespace WingCloudServer.InteractionCenter
                 var serverPageInfo = await _distributedServerInfoDBService.GetDistributedServerInfoPagesAsync(request);
                 if (serverPageInfo != null && serverPageInfo.TotalCount > 0 && serverPageInfo.PageData != null && serverPageInfo.PageData.Any()) {
                     serverInformationList = serverPageInfo.PageData.Select(d => new ServerInformation{
+                        Code = d.ServerCode,
                         Name = d.Name,
                         Host = d.ServerUrl
                     }).ToList();
@@ -353,6 +355,7 @@ namespace WingCloudServer.InteractionCenter
                 var serverPageInfo = await _distributedServerInfoDBService.GetDistributedServerInfoDBByCodesAsync(request);
                 if (serverPageInfo != null && serverPageInfo.Any()) {
                     serverInformationList = serverPageInfo.Select(d => new ServerInformation{
+                        Code = d.ServerCode,
                         Name = d.Name,
                         Host = d.ServerUrl
                     }).ToList();
@@ -371,13 +374,6 @@ namespace WingCloudServer.InteractionCenter
                 try
                 {
                     _fastestServerManager.Remove(serverInformation.Code);
-                    // var tokenDB = await _tokenDBService.FindTokenByValueAsync(token.Code);
-                    // if (tokenDB != null && !string.IsNullOrWhiteSpace(tokenDB.Code))
-                    // {
-                    //     tokenDB.Expiration = token.Expiration;
-                    //     await _tokenDBService.UpdateTokenAsync(token.Code, tokenDB);
-                    //     _serverTokenManager.Remove(tokenDB.Code);
-                    // }
                 }
                 catch (Exception ex)
                 {

+ 3 - 0
src/appsettings.json

@@ -76,5 +76,8 @@
     "Enable": true,
     "StartToolName":"startTool.bat",
     "ClosedToolName":"closedTool.bat"
+  },
+  "FastServer": {
+    "ServerHost": "http://*:9304/"
   }
 }