Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,20 @@ object JvmAdvisor {
}

private fun report() {
val advice = runCatching { evaluate(snapshot()) }
.onFailure { logger.warn("Could not evaluate JVM memory advice", it) }
.getOrNull() ?: return
logger.info("JVM advice: {}", advice.message)
Thread({
val advice = runCatching { evaluate(snapshot()) }
.onFailure { logger.warn("Could not evaluate JVM memory advice", it) }
.getOrNull() ?: return@Thread
logger.info("JVM advice: {}", advice.message)
//? if > 1.8.9 {
Minecraft.getInstance().execute { showAdvice(advice) }
//?} else {
/*Minecraft.getInstance().tell { showAdvice(advice) }
*///?}
}, "polyplus-jvm-advisor").apply { isDaemon = true }.start()
}

private fun showAdvice(advice: Advice) {
if (!PolyPlusConfig.ramAdviceNotifications) return
val now = System.currentTimeMillis()
if (now - PolyPlusConfig.jvmAdviceShownAt < ADVICE_INTERVAL_MS) return
Expand Down