1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add git commit hash to intercom status version reporting

This commit is contained in:
NG (Graham)
2026-02-08 11:18:25 -05:00
parent 93beb1b4e7
commit f1c6a5b707
13 changed files with 37 additions and 11 deletions

View File

@@ -17,5 +17,6 @@ oj_polariton_auth = { version = "*", path = "../polariton_auth" }
polariton_server.workspace = true
oj_rc_core = { version = "*", path = "../rc_core" }
async-trait.workspace = true
git-version.workspace = true
chrono.workspace = true
oj_serdes.workspace = true

View File

@@ -291,12 +291,15 @@ async fn do_connect_handshake(
}
pub async fn update_status(user_info: &dyn oj_rc_core::persist::user::IntercomUser) {
let version = env!("CARGO_PKG_VERSION");
let git_version = git_version::git_version!(args = ["--always", "--dirty=+"]);
let full_version = format!("{}:{}", version, git_version);
user_info.update_status(
env!("CARGO_PKG_NAME"),
oj_serdes::ServerStatus {
uptime_s: (chrono::Utc::now().timestamp() - crate::START_TIMESTAMP_S.load(std::sync::atomic::Ordering::Relaxed)).try_into().unwrap_or_default(),
players: ONLINE_USERS.load(std::sync::atomic::Ordering::SeqCst),
version: env!("CARGO_PKG_VERSION").to_owned(),
version: full_version,
},
).await;
}