Improve uptime
This commit is contained in:
@@ -445,9 +445,7 @@ class DashboardViewModel : BaseViewModel<DashboardUiState, UiEvent>(), CommandCl
|
|||||||
checkDeprecatedNotes()
|
checkDeprecatedNotes()
|
||||||
commandClient.connect()
|
commandClient.connect()
|
||||||
reloadSystemProxyStatus()
|
reloadSystemProxyStatus()
|
||||||
updateState {
|
reloadStartedAt()
|
||||||
copy(serviceStartTime = System.currentTimeMillis())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Status.Stopped -> {
|
Status.Stopped -> {
|
||||||
@@ -478,6 +476,20 @@ class DashboardViewModel : BaseViewModel<DashboardUiState, UiEvent>(), CommandCl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun reloadStartedAt() {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
try {
|
||||||
|
val startedAt = Libbox.newStandaloneCommandClient().startedAt
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
updateState {
|
||||||
|
copy(serviceStartTime = startedAt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun reloadSystemProxyStatus() {
|
private fun reloadSystemProxyStatus() {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user