Skip to content

Commit 35674d4

Browse files
Recheerecheej
Rechee
authored andcommitted
change if statements
1 parent 32447f9 commit 35674d4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

reactive/kotlinx-coroutines-rx2/src/RxScheduler.kt

+2-4
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ private class DispatcherScheduler(val dispatcher: CoroutineDispatcher) : Schedul
5353
if (!scope.isActive) return Disposables.disposed()
5454
val newBlock = RxJavaPlugins.onSchedule(block)
5555
return scope.launch {
56-
if (delay > 0) {
57-
delay(unit.toMillis(delay))
58-
}
56+
delay(unit.toMillis(delay))
5957
newBlock.run()
6058
}.asDisposable()
6159
}
@@ -97,7 +95,7 @@ private class DispatcherScheduler(val dispatcher: CoroutineDispatcher) : Schedul
9795
val taskJob = Job(workerJob)
9896
val task = SchedulerChannelTask(newBlock, taskJob)
9997

100-
if (delay == 0L) {
98+
if (delay <= 0L) {
10199
blockChannel.offer(task)
102100
} else {
103101
// Use `taskJob` as the parent here so the delay will also get cancelled if the Disposable

0 commit comments

Comments
 (0)