Skip to content

Commit

Permalink
Merge branch 'master' into mypyc
Browse files Browse the repository at this point in the history
  • Loading branch information
monosans authored Oct 31, 2024
2 parents 57375ca + 5446b6d commit d24a437
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions djlint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,13 @@ def main(

progress_char = " »" if sys.platform == "win32" else "┈━"

worker_count = os.cpu_count() or 1
if sys.platform == "win32":
worker_count = min(worker_count, 60)

executor_cls = (
ProcessPoolExecutor if worker_count > 1 else ThreadPoolExecutor
ThreadPoolExecutor
if min(os.cpu_count() or 1, len(file_list)) == 1
else ProcessPoolExecutor
)

with executor_cls(max_workers=worker_count) as exe:
with executor_cls() as exe:
futures = {
exe.submit(process, config, this_file): this_file
for this_file in file_list
Expand Down

0 comments on commit d24a437

Please sign in to comment.