Skip to content

Commit

Permalink
thread pool exectuor windows
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Mar 8, 2024
1 parent f4e085a commit 77ad9ab
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions ofscraper/actions/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

import asyncio
import logging
from concurrent.futures import ThreadPoolExecutor
import platform
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor

from rich.live import Live

Expand All @@ -34,7 +35,6 @@
import ofscraper.utils.args.read as read_args
import ofscraper.utils.cache as cache
import ofscraper.utils.console as console_
import ofscraper.utils.constants as constants
import ofscraper.utils.context.stdout as stdout
import ofscraper.utils.progress as progress_utils
import ofscraper.utils.system.free as free
Expand Down Expand Up @@ -460,10 +460,13 @@ async def process_labels(model_id, username):


async def process_areas(ele, model_id) -> list:
from concurrent.futures import ProcessPoolExecutor

executor = (
ProcessPoolExecutor()
if platform.system() != "Windows"
else ThreadPoolExecutor()
)
try:
with ProcessPoolExecutor() as executor:
with executor:
asyncio.get_event_loop().set_default_executor(executor)
username = ele.name
final_post_areas = set(areas.get_download_area())
Expand Down

0 comments on commit 77ad9ab

Please sign in to comment.