Skip to content

Commit 321cc3d

Browse files
committed
chore: use duration for channel timeout
1 parent cd22987 commit 321cc3d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ class LightningRepo @Inject constructor(
10491049

10501050
Logger.info("Waiting for usable channels before sending payment", context = TAG)
10511051

1052-
val finalState = withTimeoutOrNull(CHANNELS_USABLE_TIMEOUT_MS) {
1052+
val finalState = withTimeoutOrNull(CHANNELS_USABLE_TIMEOUT) {
10531053
_lightningState.first { it.shouldStopWaitingForUsableChannels() }
10541054
} ?: run {
10551055
Logger.warn("Timed out waiting for usable channels", context = TAG)
@@ -1065,7 +1065,7 @@ class LightningRepo @Inject constructor(
10651065
if (state.channels.isNotEmpty() || state.nodeLifecycleState.isRunning()) return state
10661066

10671067
Logger.info("Waiting for node to load channels before sending payment", context = TAG)
1068-
return withTimeoutOrNull(CHANNELS_USABLE_TIMEOUT_MS) {
1068+
return withTimeoutOrNull(CHANNELS_USABLE_TIMEOUT) {
10691069
_lightningState.first { it.shouldStopWaitingForLoadedChannels() }
10701070
} ?: run {
10711071
Logger.warn("Timed out waiting for node to load channels", context = TAG)
@@ -1544,7 +1544,7 @@ class LightningRepo @Inject constructor(
15441544
private const val LENGTH_CHANNEL_ID_PREVIEW = 10
15451545
private const val MS_SYNC_LOOP_DEBOUNCE = 500L
15461546
private const val SYNC_RETRY_DELAY_MS = 15_000L
1547-
private const val CHANNELS_USABLE_TIMEOUT_MS = 15_000L
1547+
private val CHANNELS_USABLE_TIMEOUT = 15.seconds
15481548
private val NO_USABLE_CHANNELS_FEEDBACK_DELAY = 2_500.milliseconds
15491549
val SEND_LN_TIMEOUT = 10.seconds
15501550
private val PROBE_TIMEOUT = 60.seconds

0 commit comments

Comments
 (0)