mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 10:53:35 -05:00
Schedule next swap job after previous job finishes
This commit is contained in:
parent
d6f3682df4
commit
a8c743cb9c
1 changed files with 14 additions and 3 deletions
|
@ -80,10 +80,9 @@ public class SwapJobImpl implements SwapJob {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
timer.scheduleAtFixedRate(
|
timer.schedule(
|
||||||
uk.ac.ic.wlgitbridge.util.Timer.makeTimerTask(this::doSwap),
|
uk.ac.ic.wlgitbridge.util.Timer.makeTimerTask(this::doSwap),
|
||||||
0,
|
0
|
||||||
interval.toMillis()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +92,18 @@ public class SwapJobImpl implements SwapJob {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSwap() {
|
private void doSwap() {
|
||||||
|
try {
|
||||||
|
doSwap_();
|
||||||
|
} catch (Throwable t) {
|
||||||
|
Log.warn("Exception thrown during swap job", t);
|
||||||
|
}
|
||||||
|
timer.schedule(
|
||||||
|
uk.ac.ic.wlgitbridge.util.Timer.makeTimerTask(this::doSwap),
|
||||||
|
interval.toMillis()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doSwap_() {
|
||||||
Log.info("Running swap number {}", swaps.get() + 1);
|
Log.info("Running swap number {}", swaps.get() + 1);
|
||||||
long totalSize = repoStore.totalSize();
|
long totalSize = repoStore.totalSize();
|
||||||
Log.info("Size is {}/{} (high)", totalSize, highWatermarkBytes);
|
Log.info("Size is {}/{} (high)", totalSize, highWatermarkBytes);
|
||||||
|
|
Loading…
Reference in a new issue