Skip to content

Commit

Permalink
change windows selector event loop max connections limit from 512 to 508
Browse files Browse the repository at this point in the history
  • Loading branch information
monosans committed Jan 9, 2025
1 parent c686de1 commit 91987e0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions proxy_scraper_checker/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import math
import stat
import sys
from asyncio.selector_events import BaseSelectorEventLoop
from pathlib import Path
from types import MappingProxyType
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -37,11 +38,9 @@

def _get_supported_max_connections() -> int | None:
if sys.platform == "win32":
if isinstance(
asyncio.get_event_loop_policy(),
asyncio.WindowsSelectorEventLoopPolicy,
):
return 512
if isinstance(asyncio.get_running_loop(), BaseSelectorEventLoop):
# 512 - len(loop._selector.get_map()) # noqa: ERA001
return 508
return None
import resource # type: ignore[unreachable, unused-ignore] # noqa: PLC0415

Expand Down

0 comments on commit 91987e0

Please sign in to comment.