Skip to content

Commit

Permalink
style: simplify FlushManager to have one-liners
Browse files Browse the repository at this point in the history
  • Loading branch information
wzieba committed Nov 3, 2023
1 parent 1326644 commit aad4629
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ internal class FlushManager(
private var job: Job? = null

fun start() {
if (job?.isActive == true) {
return
}
if (job?.isActive == true) return

job = coroutineScope.launch {
while (isActive) {
delay(intervalMillis)
Expand All @@ -32,9 +31,7 @@ internal class FlushManager(
}
}

fun stop() {
job?.cancel()
}
fun stop() = job?.cancel()

val isRunning: Boolean
get() = job?.isActive ?: false
Expand Down

0 comments on commit aad4629

Please sign in to comment.