|
19 | 19 | package org.neo4j.driver.internal.util;
|
20 | 20 |
|
21 | 21 | import static java.util.Collections.unmodifiableList;
|
22 |
| -import static org.mockito.Mockito.mock; |
23 | 22 |
|
24 | 23 | import io.netty.util.concurrent.EventExecutor;
|
25 | 24 | import io.netty.util.concurrent.EventExecutorGroup;
|
@@ -148,17 +147,24 @@ public <T> Future<T> submit(Callable<T> task) {
|
148 | 147 |
|
149 | 148 | @Override
|
150 | 149 | public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
|
151 |
| - scheduleDelays.add(unit.toMillis(delay)); |
152 |
| - delegate.execute(command); |
153 |
| - return mock(ScheduledFuture.class); |
| 150 | + var delayMillis = unit.toMillis(delay); |
| 151 | + scheduleDelays.add(delayMillis); |
| 152 | + if (delayMillis > 100) { |
| 153 | + // Ensure there is some delay to prevent Mono.delayElement going silent (reactor-core 3.5.7) |
| 154 | + delayMillis = 100; |
| 155 | + } |
| 156 | + return delegate.schedule(command, delayMillis, TimeUnit.MILLISECONDS); |
154 | 157 | }
|
155 | 158 |
|
156 | 159 | @Override
|
157 |
| - @SuppressWarnings("unchecked") |
158 | 160 | public <V> ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) {
|
159 |
| - scheduleDelays.add(unit.toMillis(delay)); |
160 |
| - delegate.submit(callable); |
161 |
| - return mock(ScheduledFuture.class); |
| 161 | + var delayMillis = unit.toMillis(delay); |
| 162 | + scheduleDelays.add(delayMillis); |
| 163 | + if (delayMillis > 100) { |
| 164 | + // Ensure there is some delay to prevent Mono.delayElement going silent (reactor-core 3.5.7) |
| 165 | + delayMillis = 100; |
| 166 | + } |
| 167 | + return delegate.schedule(callable, delayMillis, TimeUnit.MILLISECONDS); |
162 | 168 | }
|
163 | 169 |
|
164 | 170 | @Override
|
|
0 commit comments