Skip to content

Commit

Permalink
restart successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
vysakh0 committed Aug 10, 2024
1 parent a5884d1 commit 26759f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/drd/cli/monitor/error_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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.")
Expand Down
13 changes: 1 addition & 12 deletions src/drd/cli/monitor/server_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 26759f9

Please sign in to comment.