refactor(build): reformat code and add tonic health dependency

- Reformatted build script with proper indentation and line breaks
- Added tonic-health dependency to Cargo.toml and updated lock file
- Improved error handling in disk cache with concurrent deletion checks
- Refactored conditional chains using && and let expressions
- Reformatted struct initialization and function parameter lists
- Added proper spacing and alignment in language stats processing
- Improved assertion formatting in test cases
- Reorganized import statements and code layout in multiple files
- Updated metrics functions with better parameter handling and formatting
This commit is contained in:
zhenyi
2026-06-11 13:56:15 +08:00
parent c32a7cad2f
commit a40da90ef9
31 changed files with 696 additions and 417 deletions
+9 -3
View File
@@ -12,11 +12,16 @@ impl RemoteService for GitksService {
) -> Result<tonic::Response<FindRemoteRepositoryResponse>, tonic::Status> {
let m = crate::metrics::RequestMetrics::new("gitks.RemoteService/FindRemoteRepository");
let inner = request.into_inner();
let span = tracing::info_span!("remote.find_remote_repository", remote_url = %inner.remote_url);
let span =
tracing::info_span!("remote.find_remote_repository", remote_url = %inner.remote_url);
let _enter = span.enter();
tracing::info!(remote_url = %inner.remote_url, "find_remote_repository");
let resp = find_remote_repository(inner).map_err(super::into_status)?;
tracing::info!(refs_count = resp.refs.len(), exists = resp.exists, "find_remote_repository done");
tracing::info!(
refs_count = resp.refs.len(),
exists = resp.exists,
"find_remote_repository done"
);
m.record("ok");
Ok(tonic::Response::new(resp))
}
@@ -27,7 +32,8 @@ impl RemoteService for GitksService {
) -> Result<tonic::Response<FindRemoteRootRefResponse>, tonic::Status> {
let m = crate::metrics::RequestMetrics::new("gitks.RemoteService/FindRemoteRootRef");
let inner = request.into_inner();
let span = tracing::info_span!("remote.find_remote_root_ref", remote_url = %inner.remote_url);
let span =
tracing::info_span!("remote.find_remote_root_ref", remote_url = %inner.remote_url);
let _enter = span.enter();
tracing::info!(remote_url = %inner.remote_url, "find_remote_root_ref");
let resp = find_remote_root_ref(inner).map_err(super::into_status)?;