mirror of https://github.com/databricks/cli.git
## Changes Add mutex synchronization in cmdio logger Log() method. ## Why Since we issue multiple calls to underlying writer, we should lock the whole method, otherwise we can get broken messages. One that can be easily reproduced today is ``` hyperfine -m 100 --show-output 'go test ./acceptance -run ^TestAccept$/^bundle$/^artifacts$/^whl_multiple$ -count=1' ... -Uploading my_test_code-0.0.1-py3-none-any.whl... -Uploading my_test_code_2-0.0.1-py3-none-any.whl... +Uploading my_test_code-0.0.1-py3-none-any.whl...Uploading my_test_code_2-0.0.1-py3-none-any.whl... Error: Command terminated with non-zero exit code 1 in benchmark iteration 54. Use the '-i'/'--ignore-failure' option if you want to ignore this. Alternatively, use the '--show-output' option to debug what went wrong. ``` An alternative could be to prepare a message fully in a local buffer and write it in one call (I’m assuming underlying writer is still synchronized). However, that’s more complicated and unclear if it’s worth it, perf-wise. ## Tests With this change I’m running the same hyperfine command with 1000 iterations with no failures. |
||
---|---|---|
.. | ||
context.go | ||
error_event.go | ||
event.go | ||
io.go | ||
io_test.go | ||
logger.go | ||
logger_test.go | ||
message_event.go | ||
render.go | ||
render_test.go | ||
testing.go |