Merge "parallelize add_partition_calls only if output_zip is None"
This commit is contained in:
@@ -1083,10 +1083,15 @@ def AddImagesToTargetFiles(filename):
|
|||||||
("system_dlkm", has_system_dlkm, AddSystemDlkm, []),
|
("system_dlkm", has_system_dlkm, AddSystemDlkm, []),
|
||||||
("system_other", has_system_other, AddSystemOther, []),
|
("system_other", has_system_other, AddSystemOther, []),
|
||||||
)
|
)
|
||||||
|
# If output_zip exists, each add_partition_calls writes bytes to the same output_zip,
|
||||||
with ThreadPoolExecutor(max_workers=len(add_partition_calls)) as executor:
|
# which is not thread-safe. So, run them in serial if output_zip exists.
|
||||||
for future in [executor.submit(add_partition, *call) for call in add_partition_calls]:
|
if output_zip:
|
||||||
future.result()
|
for call in add_partition_calls:
|
||||||
|
add_partition(*call)
|
||||||
|
else:
|
||||||
|
with ThreadPoolExecutor(max_workers=len(add_partition_calls)) as executor:
|
||||||
|
for future in [executor.submit(add_partition, *call) for call in add_partition_calls]:
|
||||||
|
future.result()
|
||||||
|
|
||||||
AddApexInfo(output_zip)
|
AddApexInfo(output_zip)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user