Skip to content

Commit cc50961

Browse files
author
goebbert1
committed
add suggestions
1 parent 4ced2e0 commit cc50961

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

jupyter_rsession_proxy/__init__.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def db_config(db_dir):
7676
def _support_args(args):
7777
ret = subprocess.check_output([get_rstudio_executable('rserver'), '--help'])
7878
help_output = ret.decode()
79-
return {arg: (help_output.find(arg) != -1) for arg in args}
79+
return {arg: (help_output.find(f"--{arg}") != -1) for arg in args}
8080

8181
def _get_www_frame_origin(default="same"):
8282
try:
@@ -117,11 +117,14 @@ def _get_cmd(port, unix_socket):
117117
cmd.append(f'--database-config-file={database_config_file}')
118118

119119
if supported_args['www-thread-pool-size']:
120+
thread_pool_size_env = os.getenv('JUPYTER_RSESSION_PROXY_THREAD_POOL_SIZE', None)
120121
try:
121-
thread_pool_size = int(os.getenv('JUPYTER_RSESSION_PROXY_THREAD_POOL_SIZE', ""))
122-
if thread_pool_size > 0:
123-
cmd.append('--www-thread-pool-size=' + str(thread_pool_size))
124-
except:
122+
if thread_pool_size_env is not None:
123+
thread_pool_size = int(thread_pool_size_env)
124+
if thread_pool_size > 0:
125+
cmd.append('--www-thread-pool-size=' + str(thread_pool_size))
126+
except ValueError:
127+
print("Invalid value for JUPYTER_RSESSION_PROXY_THREAD_POOL_SIZE. Must be an integer.")
125128
pass
126129

127130
if unix_socket != "":

0 commit comments

Comments
 (0)