Skip to content

Commit 2bf53a9

Browse files
Zsombor Erdődy-Nagyzsxwing
Zsombor Erdődy-Nagy
authored andcommitted
Spare a few redundant calls in SleepingAction around determining the delay value (#3903)
- Remove redundant outer conditional. - Skip calling into System.currentTimeMillis(), which could potentially result in different values.
1 parent d82f1be commit 2bf53a9

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/main/java/rx/internal/schedulers/SleepingAction.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,14 @@ public void call() {
3434
if (innerScheduler.isUnsubscribed()) {
3535
return;
3636
}
37-
if (execTime > innerScheduler.now()) {
38-
long delay = execTime - innerScheduler.now();
39-
if (delay > 0) {
40-
try {
41-
Thread.sleep(delay);
42-
} catch (InterruptedException e) {
43-
Thread.currentThread().interrupt();
44-
throw new RuntimeException(e);
45-
}
37+
38+
long delay = execTime - innerScheduler.now();
39+
if (delay > 0) {
40+
try {
41+
Thread.sleep(delay);
42+
} catch (InterruptedException e) {
43+
Thread.currentThread().interrupt();
44+
throw new RuntimeException(e);
4645
}
4746
}
4847

0 commit comments

Comments
 (0)