Skip to content

Commit

Permalink
bump stundenplan24-wrapper version and modify executors
Browse files Browse the repository at this point in the history
(cherry picked from commit 8c76d3d)
  • Loading branch information
Belissimo-T committed Sep 28, 2024
1 parent 01f9792 commit 769dc04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion backend/load_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, school_number: str, plan_downloader: PlanDownloader, plan_pro
self.school_number = school_number
self.plan_downloader = plan_downloader
self.plan_processor = plan_processor
self._plan_compute_executor = concurrent.futures.ThreadPoolExecutor(max_workers=3)
self._plan_compute_executor = concurrent.futures.ProcessPoolExecutor(max_workers=1)

async def check_infinite(self, interval: int = 60, *, once: bool = False, ignore_exceptions: bool = False):
try:
Expand Down Expand Up @@ -83,6 +83,8 @@ async def get_crawlers(session: requests.Session | None = None,
creds_provider = get_creds_provider(Path("creds.json"))
_creds = creds_provider.get_creds()

request_executor = concurrent.futures.ThreadPoolExecutor(max_workers=5)

crawlers = {}

for school_name, data in _creds.items():
Expand All @@ -108,10 +110,12 @@ async def get_crawlers(session: requests.Session | None = None,
for plan_client in client.substitution_plan_clients:
plan_client.proxy_provider = proxy_provider
plan_client.no_delay = True
plan_client.request_executor = request_executor

for plan_client in client.indiware_mobil_clients:
# plan_client.proxy_provider = proxy_provider
plan_client.no_delay = True
plan_client.request_executor = request_executor
else:
client = None

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Flask-WTF~=1.1.1
Flask-Compress~=1.13
pymongo~=4.3.3
python-dotenv~=1.0.0
stundenplan24-wrapper@ git+https://github.com/Belissimo-T/stundenplan24-wrapper@bec25b2f
stundenplan24-wrapper@ git+https://github.com/Belissimo-T/stundenplan24-wrapper@4187258a
Werkzeug~=2.3.6
discord-webhook~=1.3.0
brotlicffi~=1.1.0.0
Expand Down

0 comments on commit 769dc04

Please sign in to comment.