mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Merge pull request #913 from pimutils/async-collections
Sync pairs asynchronously
This commit is contained in:
commit
a5731b269e
1 changed files with 9 additions and 5 deletions
|
|
@ -129,6 +129,7 @@ def sync(ctx, collections, force_delete):
|
||||||
async def main(collections):
|
async def main(collections):
|
||||||
conn = aiohttp.TCPConnector(limit_per_host=16)
|
conn = aiohttp.TCPConnector(limit_per_host=16)
|
||||||
|
|
||||||
|
tasks = []
|
||||||
for pair_name, collections in collections:
|
for pair_name, collections in collections:
|
||||||
async for collection, config in prepare_pair(
|
async for collection, config in prepare_pair(
|
||||||
pair_name=pair_name,
|
pair_name=pair_name,
|
||||||
|
|
@ -136,13 +137,16 @@ def sync(ctx, collections, force_delete):
|
||||||
config=ctx.config,
|
config=ctx.config,
|
||||||
connector=conn,
|
connector=conn,
|
||||||
):
|
):
|
||||||
await sync_collection(
|
tasks.append(
|
||||||
collection=collection,
|
sync_collection(
|
||||||
general=config,
|
collection=collection,
|
||||||
force_delete=force_delete,
|
general=config,
|
||||||
connector=conn,
|
force_delete=force_delete,
|
||||||
|
connector=conn,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
await asyncio.gather(*tasks)
|
||||||
await conn.close()
|
await conn.close()
|
||||||
|
|
||||||
asyncio.run(main(collections))
|
asyncio.run(main(collections))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue