mirror of
https://github.com/FutaGuard/LowTechFilter.git
synced 2025-06-21 05:21:02 +08:00
Optimize task creation with list comprehension
This commit is contained in:
parent
14f0a3ba7f
commit
624f5c8b58
@ -48,10 +48,10 @@ class Phase1:
|
||||
async def run(self):
|
||||
today = arrow.utcnow()
|
||||
for i in range(1, 31, 5):
|
||||
task = []
|
||||
for j in range(i, i + 5):
|
||||
date = today.shift(days=-j)
|
||||
task.append(asyncio.create_task(self.fetch(date)))
|
||||
task = [
|
||||
asyncio.create_task(self.fetch(today.shift(days=-j)))
|
||||
for j in range(i, i + 5)
|
||||
]
|
||||
await asyncio.gather(*task)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user