Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit 37dea0f

Browse files
committed
give up...revert
why ?: WARN for http://tfb-server:8080/queries?queries=20 11432 executed queries in the database instead of 10240 expected. This number is excessively high.
1 parent 4feeede commit 37dea0f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.WebApi/Program.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,31 @@ static async Task Main()
6262
//[WebFunctionAopTry]
6363
public static async Task<world> db()
6464
{
65-
//await using IDb con = await mysql.Connect();
66-
world obj = await WorldService.GetRandomWorld(mysql);
65+
await using IDb con = await mysql.Connect();
66+
world obj = await WorldService.GetRandomWorld(con);
6767
return obj;
6868
}
6969
//[WebFunctionAopTry]
7070
public static async Task<world[]> queries(string queries)
7171
{
7272
int count = ParseCount(queries);
7373

74-
//await using IDb con = await mysql.Connect();
75-
world[] lst = await WorldService.GetWorlds(mysql, count);
74+
await using IDb con = await mysql.Connect();
75+
world[] lst = await WorldService.GetWorlds(con, count);
7676
return lst;
7777
}
7878
//[WebFunctionAopTry]
7979
public static async Task<world[]> updates(string queries)
8080
{
8181
int count = ParseCount(queries);
8282

83-
//await using IDb con = await mysql.Connect();
84-
world[] lst = await WorldService.GetWorlds(mysql, count);
83+
await using IDb con = await mysql.Connect();
84+
world[] lst = await WorldService.GetWorlds(con, count);
8585

8686
foreach (world obj in lst)
8787
obj.randomNumber = Random.Shared.Next(1, 10001);
8888

89-
await WorldService.SaveWorlds(mysql, lst);
89+
await WorldService.SaveWorlds(con, lst);
9090

9191
return lst;
9292
}

frameworks/CSharp/akazawayun.pro/src/AkazawaYun.Benchmark.WebApi/WorldService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class WorldService
1818
}).Where(m => m.id == @id).Build();
1919

2020

21-
public static async Task<world> GetRandomWorld(akaDbFactory con, IDictionary<string, object?>? shared = null)
21+
public static async Task<world> GetRandomWorld(IDb con, IDictionary<string, object?>? shared = null)
2222
{
2323
int id = Random.Shared.Next(1, 10001);
2424
shared ??= new DpSingleBuilder().Build();
@@ -27,7 +27,7 @@ public static async Task<world> GetRandomWorld(akaDbFactory con, IDictionary<str
2727
world? obj = await con.Find(SqlSelect, shared).Toworld();
2828
return obj!;
2929
}
30-
public static async Task<world[]> GetWorlds(akaDbFactory con, int count)
30+
public static async Task<world[]> GetWorlds(IDb con, int count)
3131
{
3232
world[] lst = new world[count];
3333
var dp = new DpSingleBuilder().Build();
@@ -38,7 +38,7 @@ public static async Task<world[]> GetWorlds(akaDbFactory con, int count)
3838
}
3939
return lst;
4040
}
41-
public static async Task SaveWorlds(akaDbFactory con, world[] lst)
41+
public static async Task SaveWorlds(IDb con, world[] lst)
4242
{
4343
await con.Execute(SqlUpdate, lst.ToDp());
4444
}

0 commit comments

Comments
 (0)