File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
frameworks/Python/aiohttp/app Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 2222randint = random .randint
2323sample = random .sample
2424Response = aiohttp .web .Response
25- json_response = aiohttp .web .json_response
2625select = sqlalchemy .select
2726flag_modified = sqlalchemy .orm .attributes .flag_modified
2827Fortune = models .Fortune
@@ -51,6 +50,14 @@ def get_num_queries(request):
5150 return 500
5251 return num_queries
5352
53+
54+ def json_response (payload ):
55+ return Response (
56+ body = orjson .dumps (payload ),
57+ content_type = "application/json" ,
58+ )
59+
60+
5461async def json (request ):
5562 """
5663 Test 1
@@ -170,9 +177,9 @@ async def updates_raw(request):
170177
171178 async with request .app ['pg' ].acquire () as conn :
172179 stmt = await conn .prepare (READ_ROW_SQL )
173- for row_id in ids :
180+ for id_ , _ in updates :
174181 # the result of this is the int previous random number which we don't actually use
175- await stmt .fetchval (row_id )
182+ await stmt .fetchval (id_ )
176183 await conn .executemany (WRITE_ROW_SQL , updates )
177184
178185 return json_response (worlds )
You can’t perform that action at this time.
0 commit comments