From 561df66d1cf7c20820a6fe6d54ce2f50568c939e Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 11 Jul 2020 20:12:28 +0800 Subject: [PATCH] Misc improvements --- .../kotlin/net/mamoe/mirai/console/setting/SettingStorage.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/SettingStorage.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/SettingStorage.kt index 2eb754fb3..e3019af1a 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/SettingStorage.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/setting/SettingStorage.kt @@ -112,9 +112,11 @@ public interface AutoSaveSettingHolder : SettingHolder, CoroutineScope { */ public open class AutoSaveSetting(private val owner: AutoSaveSettingHolder, private val storage: SettingStorage) : AbstractSetting() { + @JvmField @Volatile internal var lastAutoSaveJob: Job? = null + @JvmField @Volatile internal var currentFirstStartTime = atomic(0L) @@ -137,7 +139,7 @@ public interface AutoSaveSettingHolder : SettingHolder, CoroutineScope { } } - final override fun onValueChanged(value: Value<*>) { + public final override fun onValueChanged(value: Value<*>) { lastAutoSaveJob = owner.launch(block = updaterBlock) }