From 26759f917de117c14525978a6fda8106b9360a53 Mon Sep 17 00:00:00 2001 From: Vysakh Sreenivasan Date: Sat, 10 Aug 2024 15:32:04 +0530 Subject: [PATCH] restart successfully --- src/drd/cli/monitor/error_resolver.py | 4 ++-- src/drd/cli/monitor/server_monitor.py | 13 +------------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/drd/cli/monitor/error_resolver.py b/src/drd/cli/monitor/error_resolver.py index a074ab3..53939fd 100644 --- a/src/drd/cli/monitor/error_resolver.py +++ b/src/drd/cli/monitor/error_resolver.py @@ -12,7 +12,6 @@ def monitoring_handle_error_with_dravid(error, line, monitor): - time.sleep(2) input = confirm_with_user("Allow Dravid to handle the current error?") if not input: return True @@ -30,6 +29,7 @@ def monitoring_handle_error_with_dravid(error, line, monitor): print_info("Identifying relevant files for error context...") error_details = f"error_msg: {error_message}, error_type: {error_type}, error_trace: {error_trace}" + files_to_check = run_with_loader( lambda: get_files_to_modify(error_details, project_context), "Analyzing project files" @@ -89,7 +89,7 @@ def monitoring_handle_error_with_dravid(error, line, monitor): # ) # if restart_input: print_info("Requesting server restart...") - monitor.request_restart() + monitor.perform_restart() # else: # print_info( # "Server restart postponed. You may need to restart manually if issues persist.") diff --git a/src/drd/cli/monitor/server_monitor.py b/src/drd/cli/monitor/server_monitor.py index ccb18d1..ddd5e4a 100644 --- a/src/drd/cli/monitor/server_monitor.py +++ b/src/drd/cli/monitor/server_monitor.py @@ -20,10 +20,8 @@ def __init__(self, project_dir: str, error_handlers: dict, command: str): self.error_handlers = error_handlers self.command = command self.process = None - self.output_queue = Queue() self.should_stop = threading.Event() self.restart_requested = threading.Event() - self.user_input_queue = Queue() self.processing_input = threading.Event() self.input_handler = InputHandler(self) self.output_monitor = OutputMonitor(self) @@ -71,18 +69,9 @@ def perform_restart(self): logger.warning("Process did not terminate, forcing...") self.process.kill() - self.output_monitor.stop() - try: logger.info(f"Starting new process with command: {self.command}") - self.process = self.start_process() - self.retry_count = 0 - self.restart_requested.clear() - self.recent_fixes.clear() - - self.output_monitor = OutputMonitor(self) - self.output_monitor.start() - + self.start() logger.info("Server restart completed.") print("Server restarted successfully. Waiting for output...") except Exception as e: