Enhancement log stream reading and writing and handle new lines and max-size#5683
Conversation
…am byte. For the most of log byte less than 1024 in a row, directly write into, otherwise chunk writting. (slightly enhancement in reducing the function calling)
enhancement of the log stream reading and writing. two criteria to write to dist: 1. reach the '\n' 2. reach the max_size how: add a new buf to cache the data unwrite and read the fixed size of array from the kernel interface each time. the maximum size of the buf would be 2 * maxSize - 1
|
please kindly give comment :) thanks all. @6543 |
|
@LUKIEYF thanks! Can you checkout the linter and tests? |
No problem :) |
changes: 1. change the if-else statement to switch to comply with the golint requirement. 2. the test case TestCopyLineByLineSizeLimit() the first testing scenario should be expected 1 write once the max size is 4 and the input bytes length is 5. 3. add three testing case about verify the scenario related to newline character appear into the bytes, the scenario of long line and the scenario of writeChunks() function would be used.
|
Hi all, thanks for your comments.
|
qwerty287
left a comment
There was a problem hiding this comment.
Thanks! Looks good to me so far. Just 2 small points.
Maybe someone else from @woodpecker-ci/maintainers would like to take a look?
|
And the linter is still not happy ;) |
Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
|
Hi all, all golangci-lint warnings are fixed thank you :) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5683 +/- ##
==========================================
+ Coverage 21.20% 21.22% +0.02%
==========================================
Files 425 425
Lines 38367 38402 +35
==========================================
+ Hits 8135 8152 +17
- Misses 29477 29491 +14
- Partials 755 759 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I saw the codecov said "Patch coverage is 72.72727% with 12 lines in your changes missing coverage." |
|
No, it's fine how it's now |
Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
for more information, see https://pre-commit.ci
2. add the break out statement after handling the EOF and writting the remaining buffer, otherwise the EOF would be treated as an error and the function cannot exit cleanly.
|
close: #5646
feature: 5646
enhancement of the log stream reading and writing.
two criteria to write to dist:
how:
add a new buf to cache the data unwrite and read the fixed size of array from the kernel interface each time.
the maximum size of the buf would be 2 * maxSize - 1