Skip to content

Commit 9e6fb8c

Browse files
authored
Merge pull request #657 from synonymdev/fix/bitkit-not-responding
fix: sync exception causing infinite loop on start
2 parents 3a4994e + ad69f24 commit 9e6fb8c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/src/main/java/to/bitkit/repositories/LightningRepo.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,12 @@ class LightningRepo @Inject constructor(
249249
connectToTrustedPeers().onFailure {
250250
Logger.error("Failed to connect to trusted peers", it, context = TAG)
251251
}
252-
sync().getOrThrow().also {
253-
scope.launch { registerForNotifications() }
252+
253+
sync().onFailure { e ->
254+
Logger.warn("Initial sync failed, event-driven sync will retry", e, context = TAG)
254255
}
256+
scope.launch { registerForNotifications() }
257+
Unit
255258
}.onFailure { e ->
256259
if (shouldRetry) {
257260
val retryDelay = 2.seconds
@@ -271,6 +274,7 @@ class LightningRepo @Inject constructor(
271274
_lightningState.update {
272275
it.copy(nodeLifecycleState = NodeLifecycleState.ErrorStarting(e))
273276
}
277+
return@withContext Result.failure(e)
274278
}
275279
}
276280
}

0 commit comments

Comments
 (0)