Skip to content

Commit 93cf5c4

Browse files
committed
fix: 修复因文件访问比初始化早而导致的启动错误问题.
由于 Launcher 比 initialFiles 更早的执行, 调用 Const 导致更早的访问了未初始化的文件, 导致第一次启动会出现错误. 改动中将 Launcher 移入 main 方法不会有影响, 相比于在 AppPaths.<init> 中初始化会更安全.
1 parent e12f858 commit 93cf5c4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scalabot-app/src/main/kotlin/AppMain.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import kotlin.system.exitProcess
1313

1414
private val log = KotlinLogging.logger { }
1515

16-
private val launcher = Launcher()
17-
.registerShutdownHook()
18-
1916
fun main(args: Array<String>): Unit = runBlocking {
2017
log.info { "ScalaBot 正在启动中..." }
2118
log.info { "数据目录: ${AppPaths.DATA_ROOT}" }
2219
log.debug { "启动参数: ${args.joinToString(prefix = "[", postfix = "]")}" }
2320
initialFiles()
21+
22+
val launcher = Launcher()
23+
.registerShutdownHook()
2424
if (Const.config.metrics.enable) {
2525
startMetricsServer()
2626
}

0 commit comments

Comments
 (0)