Skip to content

Commit

Permalink
fix: version checks crashing
Browse files Browse the repository at this point in the history
Fixes #827.
  • Loading branch information
iisakkirotko committed Dec 3, 2024
1 parent 44a9956 commit 1bafabc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion solara/server/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import logging
import pdb
import queue
import re
import struct
import warnings
from binascii import b2a_base64
Expand Down Expand Up @@ -73,7 +74,7 @@ def json_dumps(data):
)


ipykernel_version = tuple(map(int, ipykernel.__version__.split(".")))
ipykernel_version = tuple(map(int, re.split(r"\D+", ipykernel.__version__)[:3]))
if ipykernel_version >= (6, 18, 0):
import comm.base_comm

Expand Down
4 changes: 2 additions & 2 deletions solara/server/starlette.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def _ensure_limiter():
# Since starlette seems to accept really large values for http, lets do the same for websockets
# An arbitrarily large value we settled on for now is 32kb
# If we don't do this, users with many cookies will fail to get a websocket connection.
ws_version = tuple(map(int, websockets.__version__.split(".")))
if ws_version[0] >= 13:
ws_major_version = int(websockets.__version__.split(".")[0])
if ws_major_version >= 13:
websockets.legacy.http.MAX_LINE_LENGTH = int(os.environ.get("WEBSOCKETS_MAX_LINE_LENGTH", str(1024 * 32))) # type: ignore
else:
websockets.legacy.http.MAX_LINE = 1024 * 32 # type: ignore
Expand Down

0 comments on commit 1bafabc

Please sign in to comment.