Skip to content

Commit

Permalink
df server config rename for compat; add terminal server config secs
Browse files Browse the repository at this point in the history
  • Loading branch information
plandes committed Oct 5, 2023
1 parent 03c8be3 commit 7fde4a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions resources/obj.conf
Expand Up @@ -46,6 +46,8 @@ data_font_size = ${rend_data_frame_layout_defaults:data_font_size}

[rend_dash_server_name]
class_name = zensols.rend.df.TerminalDashServer
sleep_secs = 1
timeout_secs = 5

[rend_data_frame_location_transmuter]:
class_name = zensols.rend.df.DataFrameLocationTransmuter
Expand Down
18 changes: 9 additions & 9 deletions src/python/zensols/rend/df.py
Expand Up @@ -436,7 +436,7 @@ class TerminalDashServer(object):
for the browser.
"""
timeout_sec: float = field(default=5)
timeout_secs: float = field(default=5)
"""The timeout in seconds to wait for the child to quit before it is
terminated.
Expand Down Expand Up @@ -491,27 +491,27 @@ def run(self):
# servers in parallel rather than wait for each in series
time.sleep(self.sleep_secs)

def shutdown(self, timeout_sec: float = None):
def shutdown(self, timeout_secs: float = None):
"""Optionally wait, and then kill the child server processes.
:param timeout_sec: the number of seconds to wait before the server
:param timeout_secs: the number of seconds to wait before the server
subprocess is killed
"""
if self._shutdown:
if logger.isEnabledFor(logging.DEBUG):
logger.debug('already shutdown')
else:
if timeout_sec is None:
timeout_sec = self.timeout_sec
if timeout_sec > 0:
if timeout_secs is None:
timeout_secs = self.timeout_secs
if timeout_secs > 0:
if logger.isEnabledFor(logging.INFO):
logger.info(f'waiting on child for {timeout_sec}s')
logger.info(f'waiting on child for {timeout_secs}s')
try:
self._par_queue.get(block=True, timeout=timeout_sec)
self._par_queue.get(block=True, timeout=timeout_secs)
except Empty:
logger.warning('killed server child process did not ' +
f'respond after {timeout_sec}s')
f'respond after {timeout_secs}s')
else:
if logger.isEnabledFor(logging.INFO):
logger.info('killing server child process')
Expand Down

0 comments on commit 7fde4a0

Please sign in to comment.