Skip to content

Commit 25f0f39

Browse files
committed
fix db update error
1 parent 0665a5b commit 25f0f39

File tree

2 files changed

+9
-32
lines changed

2 files changed

+9
-32
lines changed

frameworks/C++/paozhu/paozhu_benchmark/conf/orm.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ dbname=hello_world
66
user=benchmarkdbuser
77
password=benchmarkdbpass
88
pretable=
9-
maxpool=120
10-
minpool=20
9+
maxpool=220
10+
minpool=30
1111
dbtype=mysql
1212

1313
type=second
@@ -17,6 +17,6 @@ dbname=hello_world
1717
user=benchmarkdbuser
1818
password=benchmarkdbpass
1919
pretable=
20-
maxpool=120
21-
minpool=20
20+
maxpool=220
21+
minpool=30
2222
dbtype=mysql

frameworks/C++/paozhu/paozhu_benchmark/controller/src/techempower.cpp

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,7 @@ asio::awaitable<std::string> techempowerdb(std::shared_ptr<httppeer> peer)
4242
unsigned int rd_num = rand_range(1, 10000);
4343
myworld.where("id", rd_num);
4444
myworld.limit(1);
45-
std::size_t n = co_await myworld.async_fetch_one();
46-
if (n == 0)
47-
{
48-
n = co_await myworld.async_fetch_one();
49-
}
50-
45+
co_await myworld.async_fetch_one();
5146
peer->output = myworld.data_tojson();
5247
co_return "";
5348
}
@@ -74,11 +69,7 @@ asio::awaitable<std::string> techempowerqueries(std::shared_ptr<httppeer> peer)
7469
myworld.wheresql.clear();
7570
unsigned int rd_num = rand_range(1, 10000);
7671
myworld.where("id", rd_num);
77-
std::size_t n = co_await myworld.async_fetch_append();
78-
if (n == 0)
79-
{
80-
n = co_await myworld.async_fetch_append();
81-
}
72+
co_await myworld.async_fetch_append();
8273
}
8374

8475
peer->output = myworld.to_json();
@@ -92,12 +83,7 @@ asio::awaitable<std::string> techempowerfortunes(std::shared_ptr<httppeer> peer)
9283
peer->set_header("Date", get_gmttime());
9384

9485
auto myfortune = orm::Fortune();
95-
std::size_t n = co_await myfortune.async_fetch();
96-
if (n == 0)
97-
{
98-
n = co_await myfortune.async_fetch();
99-
}
100-
86+
co_await myfortune.async_fetch();
10187
myfortune.data.id = 0;
10288
myfortune.data.message = "Additional fortune added at request time.";
10389
myfortune.record.push_back(myfortune.data);
@@ -144,22 +130,13 @@ asio::awaitable<std::string> techempowerupdates(std::shared_ptr<httppeer> peer)
144130
{
145131
myworld.wheresql.clear();
146132
myworld.where("id", rand_range(1, 10000));
147-
std::size_t n = co_await myworld.async_fetch_append();
148-
if (n == 0)
149-
{
150-
n = co_await myworld.async_fetch_append();
151-
}
133+
co_await myworld.async_fetch_append();
152134
if (myworld.effect() > 0)
153135
{
154136
unsigned int j = myworld.record.size() - 1;
155137
myworld.data.randomnumber = rand_range(1, 10000);
156138
myworld.record[j].randomnumber = myworld.data.randomnumber;
157-
158-
n = co_await myworld.async_update("randomnumber");
159-
if (n == 0)
160-
{
161-
n = co_await myworld.async_update("randomnumber");
162-
}
139+
co_await myworld.async_update("randomnumber");
163140
}
164141
}
165142
peer->output = myworld.to_json();

0 commit comments

Comments
 (0)