Skip to content

Commit c644582

Browse files
committed
fix: skip logs when chan is full
1 parent d846887 commit c644582

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

backend/xray/log.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ func (c *Core) captureProcessLogs(ctx context.Context, pipe io.Reader) {
3333
return // Exit gracefully if stop signal received
3434
default:
3535
output := scanner.Text()
36-
c.logsChan <- output
36+
// Non-blocking send: skip if channel is full to prevent deadlock
37+
select {
38+
case c.logsChan <- output:
39+
// Log sent successfully
40+
default:
41+
// Channel full, skip this log (prevents blocking xray process)
42+
}
3743
c.detectLogType(output)
3844
}
3945
}

0 commit comments

Comments
 (0)