mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-17 04:13:34 +00:00
Merge pull request #43 from overleaf/msw-auto-gc
Queue a garbage collection job after pushing to a repo
This commit is contained in:
commit
0908e8e607
3 changed files with 25 additions and 2 deletions
|
@ -419,6 +419,8 @@ public class Bridge {
|
|||
Log.warn("[{}] IOException on put", projectName);
|
||||
throw e;
|
||||
}
|
||||
|
||||
gcJob.queueForGc(projectName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package uk.ac.ic.wlgitbridge.bridge.gc;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.stubbing.OngoingStubbing;
|
||||
import uk.ac.ic.wlgitbridge.bridge.lock.LockGuard;
|
||||
|
@ -24,9 +26,20 @@ public class GcJobImplTest {
|
|||
|
||||
RepoStore repoStore = mock(RepoStore.class);
|
||||
|
||||
ProjectLock locks = new ProjectLockImpl();
|
||||
ProjectLock locks;
|
||||
|
||||
GcJobImpl gcJob = new GcJobImpl(repoStore, locks, 5);
|
||||
GcJobImpl gcJob;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
locks = new ProjectLockImpl();
|
||||
gcJob = new GcJobImpl(repoStore, locks, 5);
|
||||
}
|
||||
|
||||
@After
|
||||
public void teardown() {
|
||||
gcJob.stop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addedProjectsAreAllEventuallyGcedOnce() throws Exception {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package uk.ac.ic.wlgitbridge.bridge.swap.job;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
@ -74,6 +75,13 @@ public class SwapJobImplTest {
|
|||
);
|
||||
}
|
||||
|
||||
@After
|
||||
public void teardown() {
|
||||
if(swapJob != null) {
|
||||
swapJob.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startingTimerAlwaysCausesASwap() {
|
||||
swapJob.lowWatermarkBytes = 16384;
|
||||
|
|
Loading…
Reference in a new issue