Skip to content

Commit 9677c07

Browse files
committed
fix: adjust buffer size limits
1 parent e0767fe commit 9677c07

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

pkg/buffer/buffer.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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()

pkg/github/actions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ func downloadLogContent(ctx context.Context, logURL string, tailLines int, maxLi
762762
}
763763

764764
bufferSize := maxLines
765-
if tailLines > maxLines && tailLines <= 500 {
765+
if tailLines > maxLines && tailLines <= 5000 {
766766
bufferSize = tailLines
767767
}
768768

0 commit comments

Comments
 (0)