apirrone commited on
Commit
ac7f424
·
1 Parent(s): effa975

Cleanup. Waiting for gradio debug

Browse files
src/reachy_mini_conversation_app/main.py CHANGED
@@ -37,7 +37,7 @@ def main():
37
  run(args)
38
 
39
 
40
- def run(args, robot=None, app_stop_event=None):
41
  """Run the Reachy Mini conversation app."""
42
  # args.gradio = True # TODO Antoine - force gradio for testing appifying
43
  # args.debug = True # TODO Antoine - force debug for testing
@@ -122,16 +122,14 @@ def run(args, robot=None, app_stop_event=None):
122
 
123
  def poll_stop_event():
124
  """Poll the stop event to allow graceful shutdown."""
125
- while not app_stop_event.is_set():
126
- logger.info("=========== Polling stop event...")
127
- time.sleep(0.1)
128
 
129
  logger.info("App stop event detected, shutting down...")
130
  try:
131
  stream_manager.close()
132
  except Exception as e:
133
  logger.error(f"Error while closing stream manager: {e}")
134
- print("APP STOP EVENT:", "YES" if app_stop_event else "NO")
135
  if app_stop_event:
136
  threading.Thread(target=poll_stop_event, daemon=True).start()
137
 
 
37
  run(args)
38
 
39
 
40
+ def run(args, robot=None, app_stop_event: threading.Event = None):
41
  """Run the Reachy Mini conversation app."""
42
  # args.gradio = True # TODO Antoine - force gradio for testing appifying
43
  # args.debug = True # TODO Antoine - force debug for testing
 
122
 
123
  def poll_stop_event():
124
  """Poll the stop event to allow graceful shutdown."""
125
+ app_stop_event.wait()
 
 
126
 
127
  logger.info("App stop event detected, shutting down...")
128
  try:
129
  stream_manager.close()
130
  except Exception as e:
131
  logger.error(f"Error while closing stream manager: {e}")
132
+
133
  if app_stop_event:
134
  threading.Thread(target=poll_stop_event, daemon=True).start()
135