@@ -12,14 +12,16 @@ import (
12
12
// This efficiently retains the most recent lines, overwriting older ones as needed.
13
13
//
14
14
// 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.
17
18
//
18
19
// 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.
23
25
//
24
26
// The function uses a ring buffer to efficiently store only the last maxJobLogLines lines.
25
27
// 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
30
32
writeIndex := 0
31
33
32
34
scanner := bufio .NewScanner (httpResp .Body )
33
- scanner .Buffer (make ([]byte , 0 , 64 * 1024 ), 1024 * 1024 )
35
+ scanner .Buffer (make ([]byte , 0 , 1024 ), 1024 * 1024 )
34
36
35
37
for scanner .Scan () {
36
38
line := scanner .Text ()
0 commit comments