fix(MeshService): wait for node db initialization with a timeout

pull/1244/head
andrekir 2024-09-13 18:30:55 -03:00
rodzic 2a234458b5
commit 52e79da803
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -1463,6 +1463,12 @@ class MeshService : Service(), Logging {
radioConfigRepository.installNodeDB(newMyNodeInfo!!, newNodes.map { it.toEntity() })
newNodes.clear() // Just to save RAM ;-)
withTimeoutOrNull(timeMillis = 5000) {
while (myNodeInfo == null) {
delay(100)
}
} ?: errormsg("Timeout: installNodeDB failed!")
haveNodeDB = true // we now have nodes from real hardware
sendToRadio(newMeshPacketTo(myNodeNum).buildAdminPacket {