Skip to content

Commit f8af02e

Browse files
changed semaphore passing in asynic function (#173)
1 parent 71ca509 commit f8af02e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

charon/pkgs/signature.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ def generate_sign(
4949
"""
5050

5151
async def sign_file(
52-
filename: str, failed_paths: List[str], generated_signs: List[str]
52+
filename: str, failed_paths: List[str], generated_signs: List[str],
53+
sem: asyncio.BoundedSemaphore
5354
):
54-
async with asyncio.BoundedSemaphore(10):
55+
async with sem:
5556
signature_file = filename + ".asc"
5657
if prefix:
5758
remote = os.path.join(prefix, signature_file)
@@ -107,13 +108,14 @@ def __do_path_cut_and(
107108
failed_paths = []
108109
generated_signs = []
109110
tasks = []
111+
sem = asyncio.BoundedSemaphore(10)
110112
for full_path in file_paths:
111113
path = full_path
112114
if path.startswith(slash_root):
113115
path = path[len(slash_root):]
114116
tasks.append(
115117
asyncio.ensure_future(
116-
path_handler(path, failed_paths, generated_signs)
118+
path_handler(path, failed_paths, generated_signs, sem)
117119
)
118120
)
119121

0 commit comments

Comments
 (0)