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

Update Oshi #892

Merged
merged 14 commits into from
Dec 10, 2023
5 changes: 4 additions & 1 deletion LavalinkServer/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ dependencies {
implementation(libs.kotlin.reflect)
implementation(libs.logback)
implementation(libs.sentry.logback)
implementation(libs.oshi)
implementation(libs.oshi) {
// This version of SLF4J does not recognise Logback 1.2.3
exclude(group = "org.slf4j", module = "slf4j-api")
}
implementation(libs.json)

compileOnly(libs.spotbugs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ class StatsCollector(val socketServer: SocketServer) {
get() {
val p = os.getProcess(os.processId)

if (p == null) {
log.warn("Could not get process stats, process null")
return 0.0
}

val output: Double = if (cpuTime != 0.0) {
val uptimeDiff = p.upTime - uptime
val cpuDiff = p.kernelTime + p.userTime - cpuTime
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fun VersionCatalogBuilder.common() {

library("logback", "ch.qos.logback", "logback-classic").version("1.2.3")
library("sentry-logback", "io.sentry", "sentry-logback").version("1.7.2")
library("oshi", "com.github.oshi", "oshi-core").version("5.7.4")
library("oshi", "com.github.oshi", "oshi-core").version("6.4.8")
library("json", "org.json", "json").version("20180813")

library("spotbugs", "com.github.spotbugs", "spotbugs-annotations").version("3.1.6")
Expand Down