Sfoglia il codice sorgente

修复一个超级bug,Mongodb Json方式查询使用了一个阻塞调用,切记Task不要使用.Result方法,这样会把异步调用变成同步调用

tanghai 7 anni fa
parent
commit
379d65ac77
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      Server/Model/Module/DB/DBQueryJsonTask.cs

+ 2 - 1
Server/Model/Module/DB/DBQueryJsonTask.cs

@@ -31,7 +31,8 @@ namespace ETModel
 			{
 				// 执行查询数据库任务
 				FilterDefinition<ComponentWithId> filterDefinition = new JsonFilterDefinition<ComponentWithId>(this.Json);
-				List<ComponentWithId> components = await dbComponent.GetCollection(this.CollectionName).FindAsync(filterDefinition).Result.ToListAsync();
+				IAsyncCursor<ComponentWithId> cursor = await dbComponent.GetCollection(this.CollectionName).FindAsync(filterDefinition);
+				List<ComponentWithId> components = await cursor.ToListAsync();
 				this.Tcs.SetResult(components);
 			}
 			catch (Exception e)