@@ -12,14 +12,16 @@ import (
1212// This efficiently retains the most recent lines, overwriting older ones as needed.
1313//
1414// Parameters:
15- // httpResp: The HTTP response whose body will be read.
16- // maxJobLogLines: The maximum number of log lines to retain.
15+ //
16+ // httpResp: The HTTP response whose body will be read.
17+ // maxJobLogLines: The maximum number of log lines to retain.
1718//
1819// Returns:
19- // string: The concatenated log lines (up to maxJobLogLines), separated by newlines.
20- // int: The total number of lines read from the response.
21- // *http.Response: The original HTTP response.
22- // error: Any error encountered during reading.
20+ //
21+ // string: The concatenated log lines (up to maxJobLogLines), separated by newlines.
22+ // int: The total number of lines read from the response.
23+ // *http.Response: The original HTTP response.
24+ // error: Any error encountered during reading.
2325//
2426// The function uses a ring buffer to efficiently store only the last maxJobLogLines lines.
2527// If the response contains more lines than maxJobLogLines, only the most recent lines are kept.
@@ -30,7 +32,7 @@ func ProcessResponseAsRingBufferToEnd(httpResp *http.Response, maxJobLogLines in
3032 writeIndex := 0
3133
3234 scanner := bufio .NewScanner (httpResp .Body )
33- scanner .Buffer (make ([]byte , 0 , 64 * 1024 ), 1024 * 1024 )
35+ scanner .Buffer (make ([]byte , 0 , 1024 ), 1024 * 1024 )
3436
3537 for scanner .Scan () {
3638 line := scanner .Text ()
0 commit comments