Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Print sccache version for Server stats #1580

Merged
merged 3 commits into from
Feb 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,12 +889,14 @@ where
async fn get_info(&self) -> Result<ServerInfo> {
let stats = self.stats.lock().await.clone();
let cache_location = self.storage.location();
let version = env!("CARGO_PKG_VERSION").to_string();
drahnr marked this conversation as resolved.
Show resolved Hide resolved
futures::try_join!(self.storage.current_size(), self.storage.max_size()).map(
move |(cache_size, max_cache_size)| ServerInfo {
stats,
cache_location,
cache_size,
max_cache_size,
version,
},
)
}
Expand Down Expand Up @@ -1423,6 +1425,7 @@ pub struct ServerInfo {
pub cache_location: String,
pub cache_size: Option<u64>,
pub max_cache_size: Option<u64>,
pub version: String,
}

/// Status of the dist client.
Expand Down Expand Up @@ -1619,6 +1622,12 @@ impl ServerInfo {
self.cache_location,
name_width = name_width
);
println!(
"{:<name_width$} {}",
"Version (client)",
self.version,
name_width = name_width
);
for &(name, val) in &[
("Cache size", &self.cache_size),
("Max cache size", &self.max_cache_size),
Expand Down
2 changes: 2 additions & 0 deletions src/test/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ fn test_server_stats() {
// Ask it for stats.
let info = request_stats(conn).unwrap();
assert_eq!(0, info.stats.compile_requests);
// Include sccache ver (cli) to validate.
assert_eq!(env!("CARGO_PKG_VERSION"), info.version);
// Now signal it to shut down.
sender.send(ServerMessage::Shutdown).ok().unwrap();
// Ensure that it shuts down.
Expand Down