Fix random arbitrary shutdown by using exceptions
This commit is contained in:
parent
9ce7eccb47
commit
21699acc25
|
@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature
|
import com.fasterxml.jackson.databind.SerializationFeature
|
||||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||||
import com.fasterxml.jackson.module.kotlin.readValue
|
import com.fasterxml.jackson.module.kotlin.readValue
|
||||||
|
import java.lang.RuntimeException
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.util.Collections
|
import java.util.Collections
|
||||||
import java.util.LinkedHashMap
|
import java.util.LinkedHashMap
|
||||||
|
@ -145,7 +146,7 @@ class ServerManager(serverSettings: ServerSettings, devSettings: DevSettings, ma
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
LOGGER.warn(e) { "Main loop failed" }
|
LOGGER.error(e) { "Main loop failed" }
|
||||||
}
|
}
|
||||||
}, 15, 15, TimeUnit.SECONDS)
|
}, 15, 15, TimeUnit.SECONDS)
|
||||||
|
|
||||||
|
@ -199,7 +200,8 @@ class ServerManager(serverSettings: ServerSettings, devSettings: DevSettings, ma
|
||||||
val state = this.state as Uninitialized
|
val state = this.state as Uninitialized
|
||||||
|
|
||||||
val remoteSettings = serverHandler.loginToControl()
|
val remoteSettings = serverHandler.loginToControl()
|
||||||
?: Main.dieWithError("Failed to get a login response from server - check API secret for validity")
|
?: throw RuntimeException("Failed to get a login response from server")
|
||||||
|
|
||||||
val server = getServer(cache, database, remoteSettings, state.serverSettings, statistics, isHandled).start()
|
val server = getServer(cache, database, remoteSettings, state.serverSettings, statistics, isHandled).start()
|
||||||
|
|
||||||
if (remoteSettings.latestBuild > Constants.CLIENT_BUILD) {
|
if (remoteSettings.latestBuild > Constants.CLIENT_BUILD) {
|
||||||
|
|
Loading…
Reference in a new issue