From 1bdfe5edf35041952d49fafa5953374d33fd3080 Mon Sep 17 00:00:00 2001 From: Robinson Date: Tue, 8 Mar 2022 23:33:50 +0100 Subject: [PATCH] Don't show macos performance hints more than once --- src/dorkbox/network/Configuration.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/dorkbox/network/Configuration.kt b/src/dorkbox/network/Configuration.kt index 43e2f2c5..e442dd53 100644 --- a/src/dorkbox/network/Configuration.kt +++ b/src/dorkbox/network/Configuration.kt @@ -145,6 +145,9 @@ class ServerConfiguration : dorkbox.network.Configuration() { open class Configuration { companion object { internal const val errorMessage = "Cannot set a property after the configuration context has been created!" + + @Volatile + private var alreadyShownTips = false } /** @@ -489,12 +492,17 @@ open class Configuration { return when { OS.isMacOsX -> { // does the recommended location exist?? + + // Default is to try the RAM drive val suggestedLocation = File("/Volumes/DevShm") if (suggestedLocation.exists()) { suggestedLocation } else { - logger.info("It is recommended to create a RAM drive for best performance. For example\n" + "\$ diskutil erasevolume HFS+ \"DevShm\" `hdiutil attach -nomount ram://\$((2048 * 2048))`\n" + "\t After this, set config.aeronLogDirectory = \"/Volumes/DevShm\"") + if (!alreadyShownTips) { + alreadyShownTips = true + logger.info("It is recommended to create a RAM drive for best performance. For example\n" + "\$ diskutil erasevolume HFS+ \"DevShm\" `hdiutil attach -nomount ram://\$((2048 * 2048))`") + } OS.TEMP_DIR }