Reduce excessive debug output by removing loop noise while keeping useful message logs

parent d3cc1eed
......@@ -78,20 +78,15 @@ class SocketCommunicator:
if self.sock:
try:
data = self.sock.recv(4096)
print(f"DEBUG: SocketCommunicator received raw data: {data}")
if data:
decoded = data.decode('utf-8').strip()
print(f"DEBUG: Decoded data: {repr(decoded)}")
msg_data = json.loads(decoded)
return Message(
msg_type=msg_data['msg_type'],
msg_id=msg_data['msg_id'],
data=msg_data['data']
)
else:
print(f"DEBUG: No data received")
except Exception as e:
print(f"DEBUG: Exception in receive_message: {e}")
except:
pass
return None
......@@ -152,15 +147,12 @@ class SocketServer:
try:
while self.running:
data = client_sock.recv(4096)
print(f"DEBUG: SocketServer received raw data: {data}")
if not data:
break
decoded = data.decode('utf-8')
print(f"DEBUG: SocketServer decoded data: {repr(decoded)}")
messages = decoded.split('\n')
for msg_str in messages:
if msg_str.strip():
print(f"DEBUG: Processing message: {repr(msg_str)}")
try:
msg_data = json.loads(msg_str)
message = Message(
......@@ -168,7 +160,6 @@ class SocketServer:
msg_id=msg_data['msg_id'],
data=msg_data['data']
)
print(f"DEBUG: Parsed message: {message}")
response = self.message_handler(message)
if response:
resp_data = json.dumps({
......@@ -177,11 +168,9 @@ class SocketServer:
'data': response.data
}).encode('utf-8')
client_sock.sendall(resp_data + b'\n')
except json.JSONDecodeError as e:
print(f"DEBUG: JSON decode error: {e}")
except json.JSONDecodeError:
pass
except Exception as e:
print(f"DEBUG: Exception in _handle_client: {e}")
except:
pass
finally:
client_sock.close()
......
......@@ -255,6 +255,7 @@ def worker_process(backend_type: str):
# Workers use TCP for interprocess communication
comm = SocketCommunicator(host='localhost', port=get_backend_worker_port(), comm_type='tcp')
print(f"DEBUG: Worker connecting to {comm.host}:{comm.port}")
comm.connect()
print(f"Analysis Worker connected to backend")
......@@ -265,8 +266,8 @@ def worker_process(backend_type: str):
while True:
try:
print(f"DEBUG: Worker {os.getpid()} waiting for message...")
message = comm.receive_message()
if message:
print(f"DEBUG: Worker {os.getpid()} received message: {message}")
if message and message.msg_type == 'analyze_request':
print(f"DEBUG: Worker received analyze_request: {message.msg_id}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment