Skip to content

Commit 8a87f3f

Browse files
authored
Merge pull request #137 from huntdatacenter/add-timeout-float
add float conversion for timeout
2 parents 048f47a + acd1708 commit 8a87f3f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

jupyter_rsession_proxy/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ def _get_cmd(port):
106106
return cmd
107107

108108
def _get_timeout(default=15):
109-
return os.getenv('RSERVER_TIMEOUT', default)
109+
try:
110+
return float(os.getenv('RSERVER_TIMEOUT', default))
111+
except Exception:
112+
return default
110113

111114
server_process = {
112115
'command': _get_cmd,
@@ -152,7 +155,10 @@ def _get_cmd(port):
152155
]
153156

154157
def _get_timeout(default=15):
155-
return os.getenv('RSESSION_TIMEOUT', default)
158+
try:
159+
return float(os.getenv('RSESSION_TIMEOUT', default))
160+
except Exception:
161+
return default
156162

157163
return {
158164
'command': _get_cmd,

0 commit comments

Comments
 (0)