Skip to content

Commit 1ebc616

Browse files
committed
Update workload.py
1 parent 0af669f commit 1ebc616

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed
Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
import asyncio
2+
async def fake_api_call(delay, data):
3+
await asyncio.sleep(0.0001)
4+
return f"Processed: {data}"
25

36

4-
async def process_data_list(data_list):
7+
async def some_api_call(urls):
58
results = []
6-
7-
for item in data_list:
8-
await asyncio.sleep(0.1)
9-
processed = item * 2 + 10
10-
results.append(processed)
11-
12-
return results
13-
14-
15-
async def main():
16-
data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
17-
result = await process_data_list(data)
18-
print(f"Processed {len(result)} items: {result}")
19-
20-
21-
if __name__ == "__main__":
22-
asyncio.run(main())
9+
for url in urls:
10+
res = await fake_api_call(1, url)
11+
results.append(res)
12+
return results

0 commit comments

Comments
 (0)