Fix error handling/missing obj timing

This commit is contained in:
Wietse Wind
2023-10-08 21:26:49 +02:00
parent f54e34c5fc
commit 8f8ffd0e66
2 changed files with 6 additions and 1 deletions

View File

@@ -52,6 +52,7 @@ connections
c.on('online', () => subscribe())
c.on('error', e => console.error(e?.message || e))
})
// Play nice with Docker etc.

View File

@@ -76,7 +76,11 @@ const ledgerReady = async (ledger, readyElement) => {
}
const waitForLedgerReady = ledgerIndex => {
return ledgers?.[String(ledgerIndex)]?.ready
if (!ledgers?.[String(ledgerIndex)]) {
ledgerReady(ledgerIndex) // Create, it'll time out by itself if it's old
}
return ledgers?.[String(ledgerIndex)]?.ready || Promise.resolve()
}
const isLedgerReady = ledgerIndex => {