mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Fixed delay is easier to reconcile with sleeps than fixed rate.
This commit is contained in:
@@ -143,7 +143,7 @@ class RendezvousPollerImpl implements RendezvousPoller, Service, EventListener {
|
||||
} catch (DbException e) {
|
||||
throw new ServiceException(e);
|
||||
}
|
||||
scheduler.scheduleAtFixedRate(this::poll, POLLING_INTERVAL_MS,
|
||||
scheduler.scheduleWithFixedDelay(this::poll, POLLING_INTERVAL_MS,
|
||||
POLLING_INTERVAL_MS, MILLISECONDS);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,6 @@ class TaskSchedulerImpl implements TaskScheduler {
|
||||
return delegate.schedule(task, delay, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> scheduleAtFixedRate(Runnable task, long delay,
|
||||
long interval, TimeUnit unit) {
|
||||
return delegate.scheduleAtFixedRate(task, delay, interval, unit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Future<?> scheduleWithFixedDelay(Runnable task, long delay,
|
||||
long interval, TimeUnit unit) {
|
||||
|
||||
@@ -122,7 +122,7 @@ public class RendezvousPollerImplTest extends BrambleMockTestCase {
|
||||
PendingContactStateChangedEvent.class, e ->
|
||||
e.getPendingContactState() == OFFLINE)));
|
||||
// Capture the poll task
|
||||
oneOf(scheduler).scheduleAtFixedRate(with(any(Runnable.class)),
|
||||
oneOf(scheduler).scheduleWithFixedDelay(with(any(Runnable.class)),
|
||||
with(POLLING_INTERVAL_MS), with(POLLING_INTERVAL_MS),
|
||||
with(MILLISECONDS));
|
||||
will(new CaptureArgumentAction<>(capturePollTask, Runnable.class,
|
||||
@@ -158,7 +158,7 @@ public class RendezvousPollerImplTest extends BrambleMockTestCase {
|
||||
PendingContactStateChangedEvent.class, e ->
|
||||
e.getPendingContactState() == FAILED)));
|
||||
// Schedule the poll task
|
||||
oneOf(scheduler).scheduleAtFixedRate(with(any(Runnable.class)),
|
||||
oneOf(scheduler).scheduleWithFixedDelay(with(any(Runnable.class)),
|
||||
with(POLLING_INTERVAL_MS), with(POLLING_INTERVAL_MS),
|
||||
with(MILLISECONDS));
|
||||
}});
|
||||
@@ -467,7 +467,7 @@ public class RendezvousPollerImplTest extends BrambleMockTestCase {
|
||||
oneOf(db).getPendingContacts(txn);
|
||||
will(returnValue(emptyList()));
|
||||
// Capture the poll task
|
||||
oneOf(scheduler).scheduleAtFixedRate(with(any(Runnable.class)),
|
||||
oneOf(scheduler).scheduleWithFixedDelay(with(any(Runnable.class)),
|
||||
with(POLLING_INTERVAL_MS), with(POLLING_INTERVAL_MS),
|
||||
with(MILLISECONDS));
|
||||
will(new CaptureArgumentAction<>(capturePollTask, Runnable.class,
|
||||
@@ -544,7 +544,7 @@ public class RendezvousPollerImplTest extends BrambleMockTestCase {
|
||||
PendingContactStateChangedEvent.class, e ->
|
||||
e.getPendingContactState() == OFFLINE)));
|
||||
// Capture the poll task
|
||||
oneOf(scheduler).scheduleAtFixedRate(with(any(Runnable.class)),
|
||||
oneOf(scheduler).scheduleWithFixedDelay(with(any(Runnable.class)),
|
||||
with(POLLING_INTERVAL_MS), with(POLLING_INTERVAL_MS),
|
||||
with(MILLISECONDS));
|
||||
will(new CaptureArgumentAction<>(capturePollTask, Runnable.class,
|
||||
|
||||
Reference in New Issue
Block a user