Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zhukaihan committed Nov 1, 2024
1 parent 9b46edc commit 01ac942
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions src/main/kotlin/flag/FlagConfigUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -303,26 +303,30 @@ internal class FlagConfigFallbackRetryWrapper(

private fun scheduleRetry() {
lock.withLock {
retryTask = executor.schedule({
lock.withLock {
if (!isRunning) {
return@schedule
}
try {
mainUpdater.start {
lock.withLock {
if (isRunning) {
scheduleRetry() // Don't care if poller start error or not, always retry.
fallbackStart()
retryTask = executor.schedule(
{
lock.withLock {
if (!isRunning) {
return@schedule
}
try {
mainUpdater.start {
lock.withLock {
if (isRunning) {
scheduleRetry() // Don't care if poller start error or not, always retry.
fallbackStart()
}
}
}
fallbackStop()
} catch (_: Throwable) {
scheduleRetry()
}
fallbackStop()
} catch (_: Throwable) {
scheduleRetry()
}
}
}, reconnIntervalRange.random(), TimeUnit.MILLISECONDS)
},
reconnIntervalRange.random(),
TimeUnit.MILLISECONDS
)
}
}

Expand All @@ -332,9 +336,13 @@ internal class FlagConfigFallbackRetryWrapper(
fallbackUpdater?.start()
} catch (_: Throwable) {
if (isRunning) {
fallbackRetryTask = executor.schedule({
fallbackStart()
}, fallbackReconnIntervalRange.random(), TimeUnit.MILLISECONDS)
fallbackRetryTask = executor.schedule(
{
fallbackStart()
},
fallbackReconnIntervalRange.random(),
TimeUnit.MILLISECONDS
)
} else {}
}
}
Expand Down

0 comments on commit 01ac942

Please sign in to comment.