mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-05-13 17:46:02 +00:00
Check scanner error in GetXrayLogs
Add a check for scanner.Err() after scanning log lines and return nil if an error occurred. This prevents further processing of potentially incomplete or invalid log entries when the scanner encountered an error.
This commit is contained in:
parent
e9979b6774
commit
fb75e3d7c7
1 changed files with 4 additions and 0 deletions
|
|
@ -846,6 +846,10 @@ func (s *ServerService) GetXrayLogs(
|
||||||
entries = append(entries, entry)
|
entries = append(entries, entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := scanner.Err(); err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if len(entries) > countInt {
|
if len(entries) > countInt {
|
||||||
entries = entries[len(entries)-countInt:]
|
entries = entries[len(entries)-countInt:]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue